コード例 #1
0
 public void removeNodes(final List<PackagingElementNode<?>> nodes) {
   Set<PackagingElement<?>> parents = new HashSet<PackagingElement<?>>();
   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);
   }
 }
コード例 #2
0
 public boolean checkCanModifyChildren(
     @NotNull PackagingElement<?> parentElement,
     @NotNull PackagingElementNode<?> parentNode,
     @NotNull Collection<? extends PackagingElementNode<?>> children) {
   final List<PackagingNodeSource> sources =
       new ArrayList<PackagingNodeSource>(parentNode.getNodeSource(parentElement));
   for (PackagingElementNode<?> child : children) {
     sources.addAll(child.getNodeSources());
   }
   return checkCanModify(sources);
 }
コード例 #3
0
 public boolean checkCanModify(
     @NotNull PackagingElement<?> element, @NotNull PackagingElementNode<?> node) {
   return checkCanModify(node.getNodeSource(element));
 }