private DbJVPackage importFiles(Controller controller, int startJobDone, int endJobDone)
      throws IOException, DbException {
    controller.checkPoint(startJobDone);
    DbJVPackage topMostPackage = null;

    List<File> filesToImport = m_params.getFilesToImport();
    List<ErrorReport> errorLog = new ArrayList<ErrorReport>();

    int i = 0, nb = filesToImport.size();

    String pattern = LocaleMgr.misc.getString("ThereAreNbFilesToImport");
    String msg = MessageFormat.format(pattern, nb);
    controller.println(msg);
    int span = endJobDone - startJobDone;

    for (File file : filesToImport) {
      String filename = file.toString();
      int idx = filename.lastIndexOf('.');
      String ext = (idx == -1) ? null : filename.substring(idx + 1);
      int jobDone = startJobDone + (i * span) / nb;

      try {
        if ("class".equals(ext)) {
          DbJVClass claz = importClassFile(filename, controller);
          if (claz != null) {
            DbJVPackage pack = (DbJVPackage) claz.getCompositeOfType(DbJVPackage.metaClass);
            topMostPackage = findTopMostPackage(topMostPackage, pack);
            addToImportedPackage(pack);
          } // end if
        } else if ("jar".equals(ext)) {
          int nextJobDone = startJobDone + ((i + 1) * span) / nb;
          topMostPackage = importJarFile(file, topMostPackage, controller, jobDone, nextJobDone);
        } // end if
      } catch (Throwable th) {
        ErrorReport report = new ErrorReport(file, th);
        errorLog.add(report);
        controller.incrementErrorsCounter();
      } // end try

      // check job done
      i++;
      controller.checkPoint(jobDone);

      // stop to reverse engineer if user has cancelled
      boolean finished = controller.isFinalState();
      if (finished) {
        break;
      }
    } // end for

    if (!errorLog.isEmpty()) {
      reportErrors(errorLog, controller);
    } // end if

    controller.checkPoint(endJobDone);
    return topMostPackage;
  } // end importFiles()
  private DbJVPackage importJarFile(
      File jarFile,
      DbJVPackage topMostPackage,
      Controller controller,
      int startJobDone,
      int endJobDone)
      throws DbException {
    DbJVClass dbClass;
    String filename = jarFile.getName();

    try {
      ZipFile zip = new ZipFile(jarFile);
      int i = 0, nb = zip.size();
      int span = endJobDone - startJobDone;

      for (Enumeration<?> e = zip.entries(); e.hasMoreElements(); ) {
        int jobDone = startJobDone + (i * span) / nb;

        ZipEntry entry = (ZipEntry) e.nextElement();
        String entryName = entry.getName();
        int idx = entryName.lastIndexOf('.');
        String ext = (idx == -1) ? null : entryName.substring(idx + 1);
        if ("class".equals(ext)) {
          InputStream is = zip.getInputStream(entry);

          ClassParser parser = new ClassParser(is, filename);
          JavaClass claz = parser.parse();
          dbClass = importClass(claz, controller);

          if (dbClass != null) {
            DbJVPackage pack = (DbJVPackage) dbClass.getCompositeOfType(DbJVPackage.metaClass);
            topMostPackage = findTopMostPackage(topMostPackage, pack);
            addToImportedPackage(pack);
          } // end if
        } // end if

        // check job done
        controller.checkPoint(jobDone);
        i++;

        // stop to reverse engineer if user has cancelled
        boolean finished = controller.isFinalState();
        if (finished) {
          break;
        }
      } // end for

      zip.close();

    } catch (IOException ex) {
      controller.println(ex.toString());
      dbClass = null;
    }

    return topMostPackage;
  } // end importClassFile()