void () { final VirtualFile dir = createFile("dir/a.txt").getParent(); final Artifact artifact = addArtifact(root().dirCopy(dir)); renameFile(dir, "xxx"); assertLayout(artifact, "<root>\n" + " dir:" + getProjectBasePath() + "/xxx"); final PackagingElementFactory packagingElementFactory = PackagingElementFactory.getInstance(); ModifiableArtifactModel model = ArtifactManager.getInstance(myProject).createModifiableModel(); ModifiableArtifact mutableArtifact = model.getOrCreateModifiableArtifact(artifact); mutableArtifact.getRootElement().removeChild(mutableArtifact.getRootElement().getChildren().get(0)); WriteAction.run(() -> { model.commit(); }); assertLayout(artifact, "<root>"); renameFile(dir, "zzz"); assertLayout(artifact, "<root>"); }