コード例 #1
0
        /// <summary>
        /// Handles a drop event
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            if (SourceNode is ActionTreeNode)
            {
                if (MessageBox.Show("Are you sure you want to move the corresponding action ?", "Move action", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    ActionTreeNode actionTreeNode = (ActionTreeNode)SourceNode;

                    DataDictionary.Rules.Action action = actionTreeNode.Item;
                    actionTreeNode.Delete();
                    AddAction(action);
                }
            }
        }
コード例 #2
0
        public override ActionTreeNode AddAction(DataDictionary.Rules.Action action)
        {
            ActionTreeNode retVal = new ActionTreeNode(action);

            Item.appendActions(action);

            Nodes.Add(retVal);
            if (Item.EnclosingRule != null && !Item.EnclosingRule.BelongsToAProcedure())
            {
                SortSubNodes();
            }

            Item.setVerified(false);
            return(retVal);
        }
コード例 #3
0
        /// <summary>
        ///     Handles a drop event
        /// </summary>
        /// <param name="sourceNode"></param>
        public override void AcceptDrop(BaseTreeNode sourceNode)
        {
            ActionTreeNode actionTreeNode = sourceNode as ActionTreeNode;

            if (actionTreeNode != null)
            {
                if (
                    MessageBox.Show("Are you sure you want to move the corresponding action ?", "Move action",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Action action = actionTreeNode.Item;
                    actionTreeNode.Delete();
                    Item.appendActions(action);
                    Item.setVerified(false);
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// Splits the selected action to several sub-actions
        /// </summary>
        public virtual void SplitHandler(object sender, EventArgs args)
        {
            DataDictionary.Interpreter.Statement.Statement statement = Item.EFSSystem.Parser.Statement(Item, Item.ExpressionText);
            DataDictionary.Interpreter.Statement.VariableUpdateStatement variableUpdateStatement = statement as DataDictionary.Interpreter.Statement.VariableUpdateStatement;
            if (variableUpdateStatement != null)
            {
                DataDictionary.Interpreter.Expression       expression       = variableUpdateStatement.Expression;
                DataDictionary.Interpreter.StructExpression structExpression = expression as DataDictionary.Interpreter.StructExpression;
                if (structExpression != null)
                {
                    Dictionary <string, DataDictionary.Interpreter.Expression> associations = structExpression.Associations;
                    foreach (KeyValuePair <string, DataDictionary.Interpreter.Expression> value in associations)
                    {
                        DataDictionary.Rules.Action action = (DataDictionary.Rules.Action)DataDictionary.Generated.acceptor.getFactory().createAction();
                        action.Expression = structExpression.Structure.ToString() + "." + value.Key + " <- " + value.Value.ToString();
                        string         aString        = value.Value.ToString();
                        ActionTreeNode actionTreeNode = new ActionTreeNode(action);

                        BaseTreeNode parent = Parent as BaseTreeNode;
                        if ((parent != null) && (parent.Nodes != null))
                        {
                            DataDictionary.Rules.RuleCondition ruleCondition = Item.Enclosing as DataDictionary.Rules.RuleCondition;
                            if (ruleCondition != null)
                            {
                                ruleCondition.appendActions(action);
                            }
                            else
                            {
                                DataDictionary.Tests.SubStep subStep = Item.Enclosing as DataDictionary.Tests.SubStep;
                                if (subStep != null)
                                {
                                    subStep.appendActions(action);
                                }
                            }
                            parent.Nodes.Add(actionTreeNode);
                        }
                    }
                }
            }
            Delete();
            SortSubNodes();
        }
コード例 #5
0
        /// <summary>
        ///     Splits the selected action to several sub-actions
        /// </summary>
        public virtual void SplitHandler(object sender, EventArgs args)
        {
            Statement statement = new Parser().Statement(Item, Item.ExpressionText);
            VariableUpdateStatement variableUpdateStatement = statement as VariableUpdateStatement;

            if (variableUpdateStatement != null)
            {
                Expression       expression       = variableUpdateStatement.Expression;
                StructExpression structExpression = expression as StructExpression;
                if (structExpression != null)
                {
                    Dictionary <Designator, Expression> associations = structExpression.Associations;
                    foreach (KeyValuePair <Designator, Expression> value in associations)
                    {
                        Action action = (Action)acceptor.getFactory().createAction();
                        action.ExpressionText = structExpression.Structure + "." + value.Key + " <- " +
                                                value.Value;
                        ActionTreeNode actionTreeNode = new ActionTreeNode(action, true);

                        BaseTreeNode parent = Parent as BaseTreeNode;
                        if (parent != null)
                        {
                            RuleCondition ruleCondition = Item.Enclosing as RuleCondition;
                            if (ruleCondition != null)
                            {
                                ruleCondition.appendActions(action);
                            }
                            else
                            {
                                SubStep subStep = Item.Enclosing as SubStep;
                                if (subStep != null)
                                {
                                    subStep.appendActions(action);
                                }
                            }
                            parent.Nodes.Add(actionTreeNode);
                        }
                    }
                }
            }
            Delete();
        }