use of com.intellij.openapi.roots.ui.configuration.artifacts.nodes.PackagingNodeSource in project intellij-community by JetBrains.
the class HideContentAction method actionPerformed.
@Override
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());
}
}
use of com.intellij.openapi.roots.ui.configuration.artifacts.nodes.PackagingNodeSource in project intellij-community by JetBrains.
the class LayoutTreeComponent method removeNodes.
public void removeNodes(final List<PackagingElementNode<?>> nodes) {
Set<PackagingElement<?>> parents = new HashSet<>();
for (PackagingElementNode<?> node : nodes) {
final List<? extends PackagingElement<?>> toDelete = node.getPackagingElements();
for (PackagingElement<?> element : toDelete) {
final Collection<PackagingNodeSource> nodeSources = node.getNodeSource(element);
if (nodeSources.isEmpty()) {
final CompositePackagingElement<?> parent = node.getParentElement(element);
if (parent != null) {
parents.add(parent);
parent.removeChild(element);
}
} else {
Collection<PackagingNodeSource> rootSources = getRootNodeSources(nodeSources);
for (PackagingNodeSource source : rootSources) {
parents.add(source.getSourceParentElement());
source.getSourceParentElement().removeChild(source.getSourceElement());
}
}
}
}
final List<PackagingElementNode<?>> parentNodes = myTree.findNodes(parents);
for (PackagingElementNode<?> parentNode : parentNodes) {
myTree.addSubtreeToUpdate(parentNode);
}
}
use of com.intellij.openapi.roots.ui.configuration.artifacts.nodes.PackagingNodeSource in project intellij-community by JetBrains.
the class HideContentAction method update.
@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);
}
Aggregations