void (@NotNull AnActionEvent e) { final List<PackagingSourceItem> items = mySourceItemsTree.getSelectedItems(); ParentElementsInfo parentsInfo = findParentAndGrandParent(myArtifactEditor.getArtifact()); if (parentsInfo == null) { return; } final Artifact artifact = parentsInfo.getGrandparentArtifact(); final ArtifactEditorContext context = myArtifactEditor.getContext(); final Runnable emptyRunnable = EmptyRunnable.getInstance(); context.editLayout(artifact, emptyRunnable); context.editLayout(parentsInfo.getParentArtifact(), emptyRunnable); parentsInfo = findParentAndGrandParent(myArtifactEditor.getArtifact());//find elements under modifiable root if (parentsInfo == null) { return; } final CompositePackagingElement<?> grandParent = parentsInfo.getGrandparentElement(); final List<String> classpath = new ArrayList<>(); context.editLayout(artifact, () -> { for (PackagingSourceItem item : items) { final List<? extends PackagingElement<?>> elements = item.createElements(context); grandParent.addOrFindChildren(elements); classpath.addAll(ManifestFileUtil.getClasspathForElements(elements, context, artifact.getArtifactType())); } }); final ArtifactEditor parentArtifactEditor = context.getOrCreateEditor(parentsInfo.getParentArtifact()); parentArtifactEditor.addToClasspath(parentsInfo.getParentElement(), classpath); ((ArtifactEditorImpl)context.getOrCreateEditor(parentsInfo.getGrandparentArtifact())).rebuildTries(); }