Ejemplo n.º 1
0
        protected override void Updater_ElementsModified(IEnumerable <string> updated)
        {
            // If there is nothing modified or the SelectionResults
            // collection is null, then return
            if (!updated.Any() || SelectionResults == null)
            {
                return;
            }

            var doc = DocumentManager.Instance.CurrentDBDocument;

            // If this modification is being parsed as part of a document
            // update that also contains a deletion, then we need to try to
            // get the elements first to see if they are valid.
            var validIds = SelectionResults.Select(doc.GetElement).Where(x => x != null).Select(x => x.UniqueId);

            // If none of the updated elements are included in the
            // list of valid ids in the selection, then return.
            if (!validIds.Any(updated.Contains))
            {
                return;
            }

            // We want this modification to trigger a graph reevaluation
            // and we want the AST for this node to be regenerated.
            OnNodeModified(forceExecute: true);
        }
Ejemplo n.º 2
0
        protected override void Updater_ElementsModified(IEnumerable <string> updated)
        {
            var doc = DocumentManager.Instance.CurrentDBDocument;

            // If an element is modified, require recalc
            if (SelectionResults == null ||
                !SelectionResults.Select(r => doc.GetElement(r).UniqueId).Any(updated.Contains))
            {
                return;
            }

            RequiresRecalc = true;
        }
Ejemplo n.º 3
0
        protected override void Updater_ElementsModified(IEnumerable <string> updated)
        {
            if (!updated.Any())
            {
                return;
            }

            var updatedSet = new HashSet <string>(updated);

            if (!SelectionResults.Select(x => x.UniqueId).Any(updatedSet.Contains))
            {
                return;
            }

            UpdateSelection(Selection);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="inputAstNodes"></param>
        /// <returns></returns>
        public override IEnumerable <AssociativeNode> BuildOutputAst(List <AssociativeNode> inputAstNodes)
        {
            AssociativeNode node;

            if (SelectionResults == null || !SelectionResults.Any())
            {
                node = AstFactory.BuildNullNode();
            }
            else
            {
                IEnumerable <AssociativeNode> strInputs = SelectionResults.Select(res => AstFactory.BuildStringNode(res) as AssociativeNode);
                ExprListNode inputNode1 = AstFactory.BuildExprList(strInputs.ToList());
                node = AstFactory.BuildFunctionCall(new Func <IEnumerable <string>, IEnumerable <SteelDbObject> >(Utils.GetDynObjects), new List <AssociativeNode>()
                {
                    inputNode1
                });
            }

            return(new[] { AstFactory.BuildAssignment(GetAstIdentifierForOutputIndex(0), node) });
        }