void (final @NotNull String pathToParent, final @NotNull PackagingElement<?> element, final @Nullable PackagingElement<?> replacement) { myLayoutTreeComponent.editLayout(() -> { final CompositePackagingElement<?> parent = findCompositeElementByPath(pathToParent); if (parent == null) return; for (PackagingElement<?> child : parent.getChildren()) { if (child.isEqualTo(element)) { parent.removeChild(child); if (replacement != null) { parent.addOrFindChild(replacement); } break; } } }); myLayoutTreeComponent.rebuildTree(); }