/*
 * Copyright 2000-2009 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jetbrains.idea.maven.importing;

import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.module.ModifiableModuleModel;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.libraries.Library;
import com.intellij.openapi.roots.libraries.LibraryTable;
import com.intellij.openapi.roots.ui.configuration.ModulesConfigurator;
import com.intellij.openapi.roots.ui.configuration.projectRoot.LibrariesModifiableModel;
import com.intellij.openapi.roots.ui.configuration.projectRoot.ProjectLibrariesConfigurable;
import com.intellij.packaging.artifacts.ModifiableArtifactModel;

public class MavenUIModifiableModelsProvider extends MavenBaseModifiableModelsProvider {
  private final ModifiableModuleModel myModel;
  private final ModulesConfigurator myModulesConfigurator;
  private final ModifiableArtifactModel myModifiableArtifactModel;
  private final LibrariesModifiableModel myLibrariesModel;

  public MavenUIModifiableModelsProvider(Project project,
                                         ModifiableModuleModel model,
                                         ModulesConfigurator modulesConfigurator,
                                         ModifiableArtifactModel modifiableArtifactModel) {
    super(project);
    myModel = model;
    myModulesConfigurator = modulesConfigurator;
    myModifiableArtifactModel = modifiableArtifactModel;

    ProjectLibrariesConfigurable configurable = ProjectLibrariesConfigurable.getInstance(project);
    myLibrariesModel = configurable.getModelProvider().getModifiableModel();
  }

  @Override
  protected ModifiableArtifactModel doGetArtifactModel() {
    return myModifiableArtifactModel;
  }

  @Override
  protected ModifiableModuleModel doGetModuleModel() {
    return myModel;
  }

  @Override
  protected ModifiableRootModel doGetRootModel(Module module) {
    return myModulesConfigurator.getOrCreateModuleEditor(module).getModifiableRootModel();
  }

  @Override
  public LibraryTable.ModifiableModel getProjectLibrariesModel() {
    return myLibrariesModel;
  }

  public Library[] getAllLibraries() {
    return myLibrariesModel.getLibraries();
  }

  public Library getLibraryByName(String name) {
    return myLibrariesModel.getLibraryByName(name);
  }

  public Library createLibrary(String name) {
    return myLibrariesModel.createLibrary(name);
  }

  public void removeLibrary(Library library) {
    myLibrariesModel.removeLibrary(library);
  }

  @Override
  protected Library.ModifiableModel doGetLibraryModel(Library library) {
    return myLibrariesModel.getLibraryModifiableModel(library);
  }

  public void commit() {
    processExternalArtifactDependencies();
  }

  public void dispose() {
  }

  public ModalityState getModalityStateForQuestionDialogs() {
    return ModalityState.defaultModalityState();
  }
}

@@ -1076,18 +1076,22 @@
 igurator
+Impl
 ;%0A
-
 import c
@@ -1328,16 +1328,75 @@
 ctModel;
+%0Aimport consulo.roots.ui.configuration.ModulesConfigurator;
 %0A%0Apublic
@@ -1560,16 +1560,20 @@
 igurator
+Impl
  myModul
@@ -2085,16 +2085,42 @@
 urator =
+ (ModulesConfiguratorImpl)
  modules
@@ -2312,16 +2312,43 @@
 sModel =
+ (LibrariesModifiableModel)
  configu
@@ -2886,24 +2886,36 @@
 Model;%0A  %7D%0A%0A
+  @Override%0A
   public Lib
@@ -2982,32 +2982,44 @@
 braries();%0A  %7D%0A%0A
+  @Override%0A
   public Library
@@ -3100,32 +3100,44 @@
 ame(name);%0A  %7D%0A%0A
+  @Override%0A
   public Library
@@ -3212,32 +3212,44 @@
 ary(name);%0A  %7D%0A%0A
+  @Override%0A
   public void re
@@ -3475,32 +3475,44 @@
 (library);%0A  %7D%0A%0A
+  @Override%0A
   public void co
@@ -3564,24 +3564,36 @@
 ies();%0A  %7D%0A%0A
+  @Override%0A
   public voi
@@ -3611,16 +3611,28 @@
  %7B%0A  %7D%0A%0A
+  @Override%0A
   public

fix compilation