private void handleRefresh(Set<IFileData> oldfiles) {
   IvyXmlWriter xw = pybase_main.beginMessage("RESOURCE");
   int ctr = 0;
   for (IFileData fd : all_files) {
     IFileData old = null;
     for (IFileData ofd : oldfiles) {
       if (ofd.getFile().equals(fd.getFile())) {
         old = ofd;
         break;
       }
     }
     if (old == null) {
       outputDelta(xw, "ADDED", fd);
       ++ctr;
     } else if (old.getLastDateLastModified() != fd.getLastDateLastModified()) {
       oldfiles.remove(old);
       outputDelta(xw, "CHANGED", fd);
       ++ctr;
     } else {
       oldfiles.remove(old);
     }
   }
   for (IFileData fd : oldfiles) {
     outputDelta(xw, "REMOVED", fd);
     ++ctr;
   }
   if (ctr > 0) {
     pybase_main.finishMessage(xw);
   }
 }
  ISemanticData getSemanticData(String file) {
    for (IFileData ifd : all_files) {
      if (ifd.getFile().getPath().equals(file)) return getParseData(ifd);
    }

    return null;
  }
  private ISemanticData parseFile(IFileData fd) {
    PybaseParser pp = new PybaseParser(this, fd);
    ISemanticData sd = pp.parseDocument();
    if (sd != null) parse_data.put(fd, sd);
    else parse_data.remove(fd);

    System.err.println("PYBASE: PARSE " + fd.getFile());
    return sd;
  }
 private void outputDelta(IvyXmlWriter xw, String act, IFileData ifd) {
   xw.begin("DELTA");
   xw.field("KIND", act);
   xw.begin("RESOURCE");
   xw.field("TYPE", "FILE");
   xw.field("PROJECT", project_name);
   xw.field("LOCATION", ifd.getFile().getAbsolutePath());
   xw.end("RESOURCE");
   xw.end("DELTA");
 }
  /** ***************************************************************************** */
  private void loadFiles(String pfx, File dir, boolean reload) {
    File[] fls = dir.listFiles(new SourceFilter());

    if (fls != null) {
      for (File f : fls) {
        if (f.isDirectory()) {
          String nm = f.getName();
          String opfx = pfx;
          if (pfx == null) pfx = nm;
          else pfx += "." + nm;
          loadFiles(pfx, f, reload);
          pfx = opfx;
        } else {
          String mnm = f.getName();
          int idx = mnm.lastIndexOf(".");
          if (idx >= 0) mnm = mnm.substring(0, idx);
          if (pfx != null) mnm = pfx + "." + mnm;
          IFileData fd = PybaseFileManager.getFileManager().getNewFileData(f, mnm, this);
          ISemanticData isd = parse_data.get(fd);
          if (reload) {
            // fd.reload();
            isd = null;
          }
          all_files.add(fd);
          if (isd == null) {
            ISemanticData sd = parseFile(fd);
            if (sd != null) {
              System.err.println("PYBASE: PARSE YIELDS: " + sd.getRootNode());
              IvyXmlWriter xw = PybaseMain.getPybaseMain().beginMessage("FILEERROR");
              xw.field("PROJECT", sd.getProject().getName());
              xw.field("FILE", fd.getFile().getPath());
              xw.begin("MESSAGES");
              for (PybaseMessage m : sd.getMessages()) {
                try {
                  System.err.println("PYBASE: PARSE ERROR: " + m);
                  PybaseUtil.outputProblem(m, sd, xw);
                } catch (Throwable t) {
                  PybaseMain.logE("Pybase error message: ", t);
                }
              }
              xw.end("MESSAGES");
              PybaseMain.getPybaseMain().finishMessage(xw);
            }
          }
        }
      }
    }
  }