コード例 #1
0
 /* (non-Javadoc)
  * @see org.eclipse.team.core.mapping.IResourceMappingScope#getMappings(java.lang.String)
  */
 public ResourceMapping[] getMappings(String id) {
   Set result = new HashSet();
   ResourceMapping[] mappings = getMappings();
   for (int i = 0; i < mappings.length; i++) {
     ResourceMapping mapping = mappings[i];
     if (mapping.getModelProviderId().equals(id)) {
       result.add(mapping);
     }
   }
   return (ResourceMapping[]) result.toArray(new ResourceMapping[result.size()]);
 }
 /**
  * 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;
 }