use of com.intellij.openapi.roots.ui.configuration.artifacts.nodes.PackagingElementNode in project intellij-community by JetBrains.
the class LayoutTree method configureUiHelper.
@Override
protected void configureUiHelper(TreeUIHelper helper) {
final Convertor<TreePath, String> convertor = new Convertor<TreePath, String>() {
@Override
public String convert(final TreePath path) {
final SimpleNode node = getNodeFor(path);
if (node instanceof PackagingElementNode) {
return ((PackagingElementNode<?>) node).getElementPresentation().getSearchName();
}
return "";
}
};
new TreeSpeedSearch(this, convertor, true);
}
use of com.intellij.openapi.roots.ui.configuration.artifacts.nodes.PackagingElementNode in project intellij-community by JetBrains.
the class LayoutTreeComponent method update.
@Override
public boolean update(DnDEvent aEvent) {
aEvent.setDropPossible(false);
aEvent.hideHighlighter();
final Object object = aEvent.getAttachedObject();
if (object instanceof PackagingElementDraggingObject) {
final DefaultMutableTreeNode parent = findParentCompositeElementNode(aEvent.getRelativePoint().getPoint(myTree));
if (parent != null) {
final PackagingElementDraggingObject draggingObject = (PackagingElementDraggingObject) object;
final PackagingElementNode node = getNode(parent);
if (node != null && draggingObject.canDropInto(node)) {
final PackagingElement element = node.getFirstElement();
if (element instanceof CompositePackagingElement) {
draggingObject.setTargetNode(node);
draggingObject.setTargetElement((CompositePackagingElement<?>) element);
final Rectangle bounds = myTree.getPathBounds(TreeUtil.getPathFromRoot(parent));
aEvent.setHighlighting(new RelativeRectangle(myTree, bounds), DnDEvent.DropTargetHighlightingType.RECTANGLE);
aEvent.setDropPossible(true);
}
}
}
}
return false;
}
use of com.intellij.openapi.roots.ui.configuration.artifacts.nodes.PackagingElementNode 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);
}
}
Aggregations