public boolean checkCanAdd(CompositePackagingElement<?> parentElement, PackagingElementNode<?> parentNode) {
    boolean allParentsAreDirectories = true;
    PackagingElementNode<?> current = parentNode;
    while (current != null && !(current instanceof ArtifactRootNode)) {
      final PackagingElement<?> element = current.getFirstElement();
      if (!(element instanceof DirectoryPackagingElement)) {
        allParentsAreDirectories = false;
        break;
      }
      current = current.getParentNode();
    }

    return allParentsAreDirectories || checkCanModify(parentElement, parentNode);
  }
public boolean checkCanAdd(CompositePackagingElement<?> parentElement, PackagingElementNode<?> parentNode)