/** Analyzes the imported library with respect to the base library. */
  public void analyze(IProgressMonitor monitor) {
    try {
      if (monitor != null) {
        monitor.setTaskName(ImportResources.ConfigurationImportService_MSG0);
      }

      data.getErrorInfo().clear();

      // Prepare the library files.
      String path = data.llData.getParentFolder();
      if (path.indexOf(File.separator + LibraryDocument.libraryFile) < 0) {
        path += File.separator + LibraryDocument.libraryFile;
      }
      File importingLibPath = new File(path);

      boolean isLibraryFile = true;
      if (!importingLibPath.exists()) {
        importingLibPath = new File(importingLibPath.getParentFile(), LibraryDocument.exportFile);
        isLibraryFile = false;
      }

      if (!importingLibPath.exists()) {
        data.getErrorInfo()
            .addError(
                NLS.bind(
                    ImportResources.ConfigurationImportService_MSG1, importingLibPath.getParent()));
        return;
      }

      boolean handleVersion = isLibraryFile;
      if (handleVersion) {
        upGradeInfo =
            new ConfigurationImportService.UpgradeInfo(
                UpgradeCallerInfo.upgradeImportConfig, importingLibPath);
        if (!handleToolVersion(importingLibPath, upGradeInfo)) {
          String errMsg = upGradeInfo.getErrorMsg();
          if (errMsg == null || errMsg.length() == 0) {
            errMsg = ImportResources.ImportConfigurationWizard_ERR_Import_configuration;
          }
          data.getErrorInfo().addError(NLS.bind(errMsg, importingLibPath.getParent()));
          return;
        }
        if (upGradeInfo.getCopiedLibFile() != null) {
          importingLibPath = upGradeInfo.getCopiedLibFile();
        }
      }

      importingLibDoc = new LibraryDocument(importingLibPath);

      boolean isConfigSpecs = importingLibDoc.isConfigSpecsOnly();

      if (isConfigSpecs) {

        specsMgr = new ConfigSpecsImportManager();

        // Scan the library file for configuration information.
        data.specs = specsMgr.getConfigSpecs(importingLibDoc);

      } else {
        if (!isLibraryFile) {
          data.getErrorInfo()
              .addError(
                  NLS.bind(
                      ImportResources.ConfigurationImportService_MSG1,
                      importingLibPath.getParent()));
          return;
        }
        data.specs = null;

        // Open the library and compare the difference.

        // need to open and close the library to have the project resources initialized properly
        String libDir = importingLibPath.getParentFile().getAbsolutePath();

        String projectName =
            "Configuration Import Project (" //$NON-NLS-1$
                + Integer.toHexString(libDir.hashCode())
                + ")"; //$NON-NLS-1$

        MethodLibraryProject.openProject(libDir, projectName, monitor);
        try {
          MethodLibrary importLibraty = LibraryUtil.loadLibrary(importingLibPath.getAbsolutePath());
          MethodLibrary baseLibrary = LibraryService.getInstance().getCurrentMethodLibrary();

          handleTypeChanges(baseLibrary, importLibraty);

          String baseLibDir = null;
          try { // Not neccessary, but prevent introducing any potential regression due to this
                // change
            File bFile = new File(baseLibrary.eResource().getURI().toFileString()).getParentFile();
            ;
            baseLibDir = bFile.getAbsolutePath();
          } catch (Throwable e) {
          }
          if (libDir.equalsIgnoreCase(baseLibDir)) {
            data.getErrorInfo()
                .addError(
                    NLS.bind(
                        ImportResources.ConfigurationImportService_MSG2,
                        importingLibPath.getParent()));
            return;
          }

          fixImportLibrarySystemPackageGUIDs(baseLibrary, importLibraty);

          diffMgr = new LibraryDiffManager(baseLibrary, importLibraty);
          diffMgr.buildDiffTree();

          if (localDebug) {
            diffMgr.rootDiffTree.debugDump();
          }

        } catch (RuntimeException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
        MethodLibraryProject.closeProject(libDir, monitor);
        MethodLibraryProject.deleteProject(libDir, monitor);
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
 public boolean isSynFreeLib() {
   return importingLibDoc.isSynFreeLib();
 }