public void configFacets(final List<MavenProjectsProcessorTask> postTasks) {
    final ModuleType moduleType = ModuleType.get(myModule);

    for (final MavenImporter importer : getSuitableImporters()) {
      final MavenProjectChanges changes;
      if (myMavenProjectChanges == null) {
        if (importer.processChangedModulesOnly()) continue;
        changes = MavenProjectChanges.NONE;
      } else {
        changes = myMavenProjectChanges;
      }

      if (importer.getModuleType() == moduleType) {
        // facets use FacetConfiguration and like that do not have modifiable models,
        // therefore we have to take write lock
        MavenUtil.invokeAndWaitWriteAction(
            myModule.getProject(),
            new Runnable() {
              public void run() {
                importer.process(
                    myModifiableModelsProvider,
                    myModule,
                    myRootModelAdapter,
                    myMavenTree,
                    myMavenProject,
                    changes,
                    myMavenProjectToModuleName,
                    postTasks);
              }
            });
      }
    }
  }
  public static List<MavenImporter> getSuitableImporters(MavenProject p) {
    List<MavenImporter> result = null;
    Set<ModuleType> moduleTypes = null;

    for (MavenImporter importer : EXTENSION_POINT_NAME.getExtensions()) {
      if (importer.isApplicable(p)) {
        if (result == null) {
          result = new ArrayList<MavenImporter>();
          moduleTypes = new THashSet<ModuleType>();
        }

        result.add(importer);
        moduleTypes.add(importer.getModuleType());
      }
    }

    if (result == null) {
      return Collections.emptyList();
    }

    if (moduleTypes.size() <= 1) {
      return result;
    }

    // This code is reached when several importers say that they are applicable but they want to
    // have different module types.
    // Now we select one module type and return only those importers that are ok with it.
    // If possible - return at least one importer that explicitly supports packaging of the given
    // maven project.
    ModuleType moduleType = result.get(0).getModuleType();
    List<String> supportedPackagings = new ArrayList<String>();
    for (MavenImporter importer : result) {
      supportedPackagings.clear();
      importer.getSupportedPackagings(supportedPackagings);
      if (supportedPackagings.contains(p.getPackaging())) {
        moduleType = importer.getModuleType();
        break;
      }
    }

    final ModuleType finalModuleType = moduleType;
    return ContainerUtil.filter(
        result,
        new Condition<MavenImporter>() {
          public boolean value(final MavenImporter importer) {
            return importer.getModuleType() == finalModuleType;
          }
        });
  }