private void doUpdateState(State newState,
                             @NotNull MavenModel model,
                             @NotNull Collection<@NotNull MavenProjectProblem> readingProblems,
                             @NotNull MavenExplicitProfiles activatedProfiles,
                             @NotNull Set<MavenId> unresolvedArtifactIds,
                             @NotNull Map<@NotNull String, @Nullable String> nativeModelMap,
                             @NotNull MavenGeneralSettings settings,
                             boolean keepPreviousArtifacts,
                             boolean keepPreviousProfiles,
                             boolean keepPreviousPlugins) {
    newState.myReadingProblems = readingProblems;
    newState.myLocalRepository = settings.getEffectiveLocalRepository();
    newState.myActivatedProfilesIds = activatedProfiles;

    newState.myMavenId = model.getMavenId();
    if (model.getParent() != null) {
      newState.myParentId = model.getParent().getMavenId();
    }

    newState.myPackaging = model.getPackaging();
    newState.myName = model.getName();

    newState.myFinalName = model.getBuild().getFinalName();
    newState.myDefaultGoal = model.getBuild().getDefaultGoal();

    newState.myBuildDirectory = model.getBuild().getDirectory();
    newState.myOutputDirectory = model.getBuild().getOutputDirectory();
    newState.myTestOutputDirectory = model.getBuild().getTestOutputDirectory();

    doSetFolders(newState, model.getBuild());

    newState.myFilters = model.getBuild().getFilters();
    newState.myProperties = model.getProperties();

    doSetResolvedAttributes(newState, model, unresolvedArtifactIds, keepPreviousArtifacts, keepPreviousPlugins);

    MavenModelPropertiesPatcher.patch(newState.myProperties, newState.myPlugins);

    newState.myModulesPathsAndNames = collectModulePathsAndNames(model, getDirectory());
    Collection<String> newProfiles = collectProfilesIds(model.getProfiles());
    if (keepPreviousProfiles && newState.myProfilesIds != null) {
      Set<String> mergedProfiles = new HashSet<>(newState.myProfilesIds);
      mergedProfiles.addAll(newProfiles);
      newState.myProfilesIds = new ArrayList<>(mergedProfiles);
    }
    else {
      newState.myProfilesIds = newProfiles;
    }

    newState.myModelMap = nativeModelMap;
  }
private void doUpdateState(State newState,
                             @NotNull MavenModel model,
                             @NotNull Collection<@NotNull MavenProjectProblem> readingProblems,
                             @NotNull MavenExplicitProfiles activatedProfiles,
                             @NotNull Set<MavenId> unresolvedArtifactIds,
                             @NotNull Map<@NotNull String, @Nullable String> nativeModelMap,
                             @NotNull MavenGeneralSettings settings,
                             boolean keepPreviousArtifacts,
                             boolean keepPreviousProfiles,
                             boolean keepPreviousPlugins)