fix: IDEA-154111 Create Test dialog: for not found Arquillian library the suggested Fix is incorrect

This commit is contained in:
Nikolay Mikhaylov
2016-05-19 11:15:46 +03:00
parent b4907ef886
commit 066b45461c
@@ -37,12 +37,16 @@ public class RepositoryAddLibraryAction extends IntentionAndQuickFixAction {
@Override
public void applyFix(@NotNull Project project, PsiFile file, @Nullable Editor editor) {
addLibraryToModule(libraryDescription, module);
}
public static void addLibraryToModule(RepositoryLibraryDescription libraryDescription, Module module) {
RepositoryLibraryPropertiesModel model = new RepositoryLibraryPropertiesModel(
RepositoryUtils.DefaultVersionId,
false,
false);
RepositoryLibraryPropertiesDialog dialog = new RepositoryLibraryPropertiesDialog(
project,
module.getProject(),
model,
libraryDescription,
false);
@@ -51,14 +55,12 @@ public class RepositoryAddLibraryAction extends IntentionAndQuickFixAction {
}
IdeaModifiableModelsProvider modifiableModelsProvider = new IdeaModifiableModelsProvider();
final ModifiableRootModel modifiableModel = modifiableModelsProvider.getModuleModifiableModel(module);
RepositoryLibrarySupport librarySupport = new RepositoryLibrarySupport(project, libraryDescription, model);
RepositoryLibrarySupport librarySupport = new RepositoryLibrarySupport(module.getProject(), libraryDescription, model);
assert modifiableModel != null;
librarySupport.addSupport(
module,
modifiableModel,
modifiableModelsProvider);
ApplicationManager.getApplication().runWriteAction(() -> {
modifiableModel.commit();
});
module,
modifiableModel,
modifiableModelsProvider);
ApplicationManager.getApplication().runWriteAction(modifiableModel::commit);
}
}