/** * Return whether the given element has children in the given scope. By default, true is returned * if the given element contains any elements in the scope or if any of the elements in the scope * contain the given element and the delegate provider returns children for the element. The * {@link ResourceMapping#contains(ResourceMapping)} is used to test for containment. Subclasses * may override to provide a more efficient implementation. * * @param scope the scope * @param element the element * @return whether the given element has children in the given scope */ protected boolean hasChildrenInScope(ISynchronizationScope scope, Object element) { ResourceMapping mapping = Utils.getResourceMapping(internalGetElement(element)); if (mapping != null) { ResourceMapping[] mappings = scope.getMappings(mapping.getModelProviderId()); for (int i = 0; i < mappings.length; i++) { ResourceMapping sm = mappings[i]; if (mapping.contains(sm)) { return true; } if (sm.contains(mapping)) { return getDelegateChildren(element).length > 0; } } } return false; }