Add entries to the gallery node

    Should happen when all the doctrees have been read
    and the gallery entries have been collected. i.e at
    doctree-resolved time.
8809
def add_entries_to_gallery(app, doctree, docname):
    
    if docname != 'gallery':
        return

    if not has_gallery(app.builder.name):
        return

    # Find gallery node
    try:
        node = doctree.traverse(gallery)[0]
    except TypeError:
        return

    content = []
    for entry in app.env.gallery_entries:
        raw_html_node = nodes.raw('', text=entry.html, format='html')
        content.append(raw_html_node)

    # Even when content is empty, we want the gallery node replaced
    node.replace_self(content)
289703
private void addLastOfType() {
		for (Node node : nodes) {
			Index index = helper.getIndexInParent(node, true);
			if (index.index == (index.size-1))
				result.add(node);
		}
	}
108188
function(){
    if (this.collection){
      this.listenTo(this.collection, "add", this.addChildView, this);
      this.listenTo(this.collection, "remove", this.removeItemView, this);
      this.listenTo(this.collection, "reset", this._renderChildren, this);
    }
  }
1191441
function onAddChild(e) {
        var self = this;
        if (e.target === self) {
            updateSubTreeStatus(self, e.component, self.get('depth'), e.index);
        }
    }
725026
public void entryAdded (EntryAddedEvent<T> event)
    {
        dispatchMethod(event.getName() + "Added",
            new Object[] { event.getEntry() });
    }
925916
private function appendCollectedFileAndChanges(): void
    {
        if (!empty($this->currentFile)) {
            foreach ($this->currentChanges as $change) {
                $this->currentFile->addChange($change);
            }
            $this->files[] = $this->currentFile;
        }
        $this->currentChanges = [];
    }
431043
private void addFirstChildElements() {
		for (Node node : nodes) {
			Index index = helper.getIndexInParent(node, false);
			if (index.index == 0)
				result.add(node);
		}
	}
169478
public void addAll(Iterable<? extends DOCUMENT> documents) {
      if (documents != null) {
         for (DOCUMENT doc : documents) {
            add(doc);
         }
      }
   }
835281
protected void addEntry (E entry)
    {
        if (_entryFilter == null || _entryFilter.apply(entry)) {
            int index = _keys.insertSorted(getKey(entry));
            _table.insertDatum(entry, index);
        }
    }
88828
protected function wizardAddCollectionItem()
    {
        $this->validatePrompt('collection_id', $this->text('Collection ID'), 'collection_item');
        $this->validatePrompt('entity_id', $this->text('Entity ID'), 'collection_item');
        $this->validatePrompt('weight', $this->text('Weight'), 'collection_item', 0);
        $this->validatePrompt('status', $this->text('Status'), 'collection_item', 0);
        $this->validatePrompt('data', $this->text('Data'), 'collection_item');

        $this->validateComponent('collection_item');
        $this->addCollectionItem();
    }
422887
public void addEntries(JsonNode data) {
        for (JsonNode webhookJson : data.get("webhooks")) {
            boolean alreadyAdded = involvedWebhooks.stream()
                    .anyMatch(webhook -> webhook.getId() == webhookJson.get("id").asLong());
            if (!alreadyAdded) {
                involvedWebhooks.add(new WebhookImpl(api, webhookJson));
            }
        }
        for (JsonNode userJson : data.get("users")) {
            boolean alreadyAdded = involvedUsers.stream()
                    .anyMatch(user -> user.getId() == userJson.get("id").asLong());
            if (!alreadyAdded) {
                involvedUsers.add(((DiscordApiImpl) api).getOrCreateUser(userJson));
            }
        }
        for (JsonNode entry : data.get("audit_log_entries")) {
            entries.add(new AuditLogEntryImpl(this, entry));
        }
    }
401100
private void leafEntryIDs(MkAppTreeNode<O> node, ModifiableDBIDs result) {
    if(node.isLeaf()) {
      for(int i = 0; i < node.getNumEntries(); i++) {
        MkAppEntry entry = node.getEntry(i);
        result.add(((LeafEntry) entry).getDBID());
      }
    }
    else {
      for(int i = 0; i < node.getNumEntries(); i++) {
        MkAppTreeNode<O> childNode = getNode(node.getEntry(i));
        leafEntryIDs(childNode, result);
      }
    }
  }
1119512
public void updateContentTree() {

        m_scrollList.clearList();
        m_childrens.clear();
        m_categories.clear();
        if ((m_resultList != null) && !m_resultList.isEmpty()) {
            // add the first level and children
            for (CmsCategoryTreeEntry category : m_resultList) {
                // set the category tree item and add to list
                CmsTreeItem treeItem = buildTreeItem(category, m_selectedCategories);
                m_childrens.put(treeItem.getId(), new ArrayList<>(category.getChildren().size()));
                addChildren(treeItem, category.getChildren(), m_selectedCategories);
                if (!category.getPath().isEmpty() || (treeItem.getChildCount() > 0)) {
                    m_scrollList.add(treeItem);
                }
                treeItem.setOpen(!m_showCollapsed);
            }
        } else {
            showIsEmptyLabel();
        }
        scheduleResize();
    }
482257
protected void addDependent(Node nodeToAdd) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "addDependent entry: node to add: " + nodeToAdd);
        }
        dependents.add(nodeToAdd);
    }
364494
protected function wizardAddCollection()
    {
        $this->validatePrompt('title', $this->text('Title'), 'collection');
        $this->validateMenu('type', $this->text('Type'), 'collection', $this->collection->getTypes());
        $this->validatePrompt('store_id', $this->text('Store'), 'collection');
        $this->validatePrompt('description', $this->text('Description'), 'collection', '');
        $this->validatePrompt('status', $this->text('Status'), 'collection', 0);

        $this->validateComponent('collection');
        $this->addCollection();
    }
564368
function _addSearchResultsForEntries(entries) {
            var fullPaths = [];
            return Async.doInParallel(entries, function (entry) {
                var addedFiles = [],
                    addedFilePaths = [],
                    deferred = new $.Deferred();

                // gather up added files
                var visitor = function (child) {
                    // Replicate filtering that getAllFiles() does
                    if (ProjectManager.shouldShow(child)) {
                        if (child.isFile && _isReadableText(child.name)) {
                            // Re-check the filtering that the initial search applied
                            if (_inSearchScope(child)) {
                                addedFiles.push(child);
                                addedFilePaths.push(child.fullPath);
                            }
                        }
                        return true;
                    }
                    return false;
                };

                entry.visit(visitor, function (err) {
                    if (err) {
                        deferred.reject(err);
                        return;
                    }

                    //node Search : inform node about the file changes
                    //filesChanged(addedFilePaths);
                    fullPaths = fullPaths.concat(addedFilePaths);

                    if (findOrReplaceInProgress) {
                        // find additional matches in all added files
                        Async.doInParallel(addedFiles, function (file) {
                            return _doSearchInOneFile(file)
                                .done(function (foundMatches) {
                                    resultsChanged = resultsChanged || foundMatches;
                                });
                        }).always(deferred.resolve);
                    } else {
                        deferred.resolve();
                    }
                });

                return deferred.promise();
            }).always(function () {
                // this should be called once with a large array instead of numerous calls with single items
                filesChanged(fullPaths);
            });
        }
882104
public void add(WorkbenchEntry entry) {
		assert ! entry.isEmpty() : entry;
		assert ! entry.acquired : entry;
		entries.add(entry);
		approximatedSize.incrementAndGet();
	}