public void actionPerformed(AnActionEvent e) { final LayoutTreeSelection selection = myArtifactEditor.getLayoutTreeComponent().getSelection(); final PackagingElementNode<?> node = selection.getNodeIfSingle(); if (node == null) return; final Collection<PackagingNodeSource> sources = node.getNodeSources(); for (PackagingNodeSource source : sources) { myArtifactEditor.getSubstitutionParameters().doNotSubstitute(source.getSourceElement()); myArtifactEditor .getLayoutTreeComponent() .getLayoutTree() .addSubtreeToUpdate(source.getSourceParentNode()); } }
@Override public void update(AnActionEvent e) { final LayoutTreeSelection selection = myArtifactEditor.getLayoutTreeComponent().getSelection(); final PackagingElementNode<?> node = selection.getNodeIfSingle(); if (node != null) { final Collection<PackagingNodeSource> sources = node.getNodeSources(); if (!sources.isEmpty()) { String description; if (sources.size() == 1) { description = "Hide Content of '" + sources.iterator().next().getPresentableName() + "'"; } else { description = "Hide Content"; } e.getPresentation().setVisible(true); e.getPresentation().setText(description); return; } } e.getPresentation().setVisible(false); }