void (final Artifact artifact, final Library library, final String oldName, final String newName) { if (ArtifactUtil.processPackagingElements(myPackagingEditorContext.getRootElement(artifact), LibraryElementType.LIBRARY_ELEMENT_TYPE, new PackagingElementProcessor<>() { @Override public boolean process(@NotNull LibraryPackagingElement element, @NotNull PackagingElementPath path) { return !isResolvedToLibrary(element, library, oldName); } }, myPackagingEditorContext, false, artifact.getArtifactType())) { return; } myPackagingEditorContext.editLayout(artifact, () -> { final ModifiableArtifact modifiableArtifact = myPackagingEditorContext.getOrCreateModifiableArtifactModel().getOrCreateModifiableArtifact(artifact); ArtifactUtil.processPackagingElements(modifiableArtifact, LibraryElementType.LIBRARY_ELEMENT_TYPE, new PackagingElementProcessor<>() { @Override public boolean process(@NotNull LibraryPackagingElement element, @NotNull PackagingElementPath path) { if (isResolvedToLibrary(element, library, oldName)) { element.setLibraryName(newName); } return true; } }, myPackagingEditorContext, false); }); final ArtifactEditorImpl artifactEditor = myPackagingEditorContext.getArtifactEditor(artifact); if (artifactEditor != null) { artifactEditor.rebuildTries(); } }