boolean () { final LibraryCompositionSettings librarySettings = myComponent.getLibraryCompositionSettings(); if (librarySettings != null) { final ModifiableRootModel modifiableModel = myModifiableModelsProvider.getModuleModifiableModel(myModule); if (!askAndRemoveDuplicatedLibraryEntry(modifiableModel, librarySettings.getLibraryDescription())) { if (myConfigurable.isOnlyLibraryAdded()) { myModifiableModelsProvider.disposeModuleModifiableModel(modifiableModel); return false; } return false; } WriteAction.run(() -> myModifiableModelsProvider.commitModuleModifiableModel(modifiableModel)); final boolean downloaded = librarySettings.downloadFiles(getRootPane()); if (!downloaded) { int answer = Messages.showYesNoDialog(getRootPane(), JavaUiBundle.message("warning.message.some.required.libraries.wasn.t.downloaded"), JavaUiBundle.message("dialog.title.libraries.are.required"), Messages.getWarningIcon()); if (answer != Messages.YES) { return false; } } } WriteAction.run(() -> { final ModifiableRootModel rootModel = myModifiableModelsProvider.getModuleModifiableModel(myModule); if (librarySettings != null) { librarySettings.addLibraries(rootModel, new ArrayList<>(), myModel.getLibrariesContainer()); } myConfigurable.addSupport(myModule, rootModel, myModifiableModelsProvider); myModifiableModelsProvider.commitModuleModifiableModel(rootModel); }); return true; }