/// <summary>
        /// Accepts a new procedure
        /// </summary>
        /// <param name="SourceNode"></param>
        public override void AcceptDrop(BaseTreeNode SourceNode)
        {
            base.AcceptDrop(SourceNode);

            if (SourceNode is ProcedureTreeNode)
            {
                ProcedureTreeNode procedureTreeNode          = SourceNode as ProcedureTreeNode;
                DataDictionary.Functions.Procedure procedure = procedureTreeNode.Item;

                procedureTreeNode.Delete();
                AddProcedure(procedure);
            }
            else if (SourceNode is SpecificationView.ParagraphTreeNode)
            {
                SpecificationView.ParagraphTreeNode    node     = SourceNode as SpecificationView.ParagraphTreeNode;
                DataDictionary.Specification.Paragraph paragaph = node.Item;

                DataDictionary.Functions.Procedure procedure = (DataDictionary.Functions.Procedure)DataDictionary.Generated.acceptor.getFactory().createProcedure();
                procedure.Name = paragaph.Name;

                DataDictionary.ReqRef reqRef = (DataDictionary.ReqRef)DataDictionary.Generated.acceptor.getFactory().createReqRef();
                reqRef.Name = paragaph.FullId;
                procedure.appendRequirements(reqRef);
                AddProcedure(procedure);
            }
        }
        public void AddHandler(object sender, EventArgs args)
        {
            Procedure procedure = (Procedure)acceptor.getFactory().createProcedure();

            procedure.Name = "<Procedure" + (GetNodeCount(false) + 1) + ">";
            Item.appendProcedures(procedure);
        }
예제 #3
0
 /// <summary>
 ///     Adds a model element in this model element
 /// </summary>
 /// <param name="element"></param>
 public override void AddModelElement(IModelElement element)
 {
     {
         Range item = element as Range;
         if (item != null)
         {
             appendRanges(item);
         }
     }
     {
         Enum item = element as Enum;
         if (item != null)
         {
             appendEnumerations(item);
         }
     }
     {
         Structure item = element as Structure;
         if (item != null)
         {
             appendStructures(item);
         }
     }
     {
         Collection item = element as Collection;
         if (item != null)
         {
             appendCollections(item);
         }
     }
     {
         Function item = element as Function;
         if (item != null)
         {
             appendFunctions(item);
         }
     }
     {
         Procedure item = element as Procedure;
         if (item != null)
         {
             appendProcedures(item);
         }
     }
     {
         Rule item = element as Rule;
         if (item != null)
         {
             appendRules(item);
         }
     }
     {
         Variable item = element as Variable;
         if (item != null)
         {
             appendVariables(item);
         }
     }
 }
예제 #4
0
 /// <summary>
 /// Constructor (for function)
 /// </summary>
 /// <param name="item"></param>
 public ProcedureParametersTreeNode(DataDictionary.Functions.Procedure item)
     : base(item, "Parameters", true, false)
 {
     foreach (DataDictionary.Parameter parameter in item.FormalParameters)
     {
         Nodes.Add(new ParameterTreeNode(parameter));
     }
 }
예제 #5
0
        /// <summary>
        ///     Creates a function in the enclosing structure
        /// </summary>
        /// <param name="enclosing"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        protected Procedure CreateProcedure(Structure enclosing, string name)
        {
            Procedure retVal = (Procedure)Factory.createProcedure();

            enclosing.appendProcedures(retVal);
            retVal.Name = name;

            return(retVal);
        }
예제 #6
0
        /// <summary>
        ///     Creates a rule and a rule condition in the procedure
        /// </summary>
        /// <param name="enclosing"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        protected RuleCondition CreateRuleAndCondition(Procedure enclosing, string name)
        {
            Rule rule = (Rule)Factory.createRule();

            enclosing.appendRules(rule);
            rule.Name = name;

            return(CreateRuleCondition(rule, name));
        }
        /// <summary>
        /// Adds a procedure in the corresponding namespace
        /// </summary>
        /// <param name="procedure"></param>
        public ProcedureTreeNode AddProcedure(DataDictionary.Functions.Procedure procedure)
        {
            Item.appendProcedures(procedure);
            ProcedureTreeNode retVal = new ProcedureTreeNode(procedure);

            Nodes.Add(retVal);
            SortSubNodes();

            return(retVal);
        }
예제 #8
0
        /// <summary>
        ///     Creates a parameter in the enclosing procedure
        /// </summary>
        /// <param name="procedure"></param>
        /// <param name="name"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        protected Parameter CreateParameter(Procedure procedure, string name, string type)
        {
            Parameter retVal = (Parameter)Factory.createParameter();

            procedure.appendParameters(retVal);
            retVal.Name     = name;
            retVal.TypeName = type;

            return(retVal);
        }
예제 #9
0
        /// <summary>
        ///     Sets the update information for this structure
        /// </summary>
        /// <param name="source">The source structure for which this structure has been created (as an update)</param>
        public override void SetUpdateInformation(ModelElement source)
        {
            base.SetUpdateInformation(source);
            Structure sourceStructure = (Structure)source;

            foreach (StructureElement element in Elements)
            {
                StructureElement baseElement = sourceStructure.FindStructureElement(element.Name);
                if (baseElement != null)
                {
                    element.SetUpdateInformation(baseElement);
                }
            }

            foreach (Procedure procedure in Procedures)
            {
                Procedure baseProcedure = sourceStructure.FindProcedure(procedure.Name);
                if (baseProcedure != null)
                {
                    procedure.SetUpdateInformation(baseProcedure);
                }
            }

            foreach (Rule rule in Rules)
            {
                Rule baseRule = sourceStructure.FindRule(rule.Name);
                if (baseRule != null)
                {
                    rule.SetUpdateInformation(baseRule);
                }
            }

            foreach (StateMachine stateMachine in StateMachines)
            {
                StateMachine baseStateMachine = sourceStructure.FindStateMachine(stateMachine.Name);
                if (baseStateMachine != null)
                {
                    stateMachine.SetUpdateInformation(baseStateMachine);
                }
            }
        }
예제 #10
0
        /// <summary>
        ///     Adds a model element in this model element
        /// </summary>
        /// <param name="element"></param>
        public override void AddModelElement(IModelElement element)
        {
            {
                StructureRef item = element as StructureRef;
                if (item != null)
                {
                    appendInterfaces(item);
                }
            }
            {
                StructureElement item = element as StructureElement;
                if (item != null)
                {
                    appendElements(item);
                }
            }
            {
                Procedure item = element as Procedure;
                if (item != null)
                {
                    appendProcedures(item);
                }
            }
            {
                StateMachine item = element as StateMachine;
                if (item != null)
                {
                    appendStateMachines(item);
                }
            }
            {
                Rule item = element as Rule;
                if (item != null)
                {
                    appendRules(item);
                }
            }

            base.AddModelElement(element);
        }
        /// <summary>
        ///     Accepts a new procedure
        /// </summary>
        /// <param name="sourceNode"></param>
        public override void AcceptDrop(BaseTreeNode sourceNode)
        {
            base.AcceptDrop(sourceNode);

            if (sourceNode is ProcedureTreeNode)
            {
                ProcedureTreeNode procedureTreeNode = sourceNode as ProcedureTreeNode;
                Procedure         procedure         = procedureTreeNode.Item;

                procedureTreeNode.Delete();
                Item.appendProcedures(procedure);
            }
            else if (sourceNode is ParagraphTreeNode)
            {
                ParagraphTreeNode node      = sourceNode as ParagraphTreeNode;
                Paragraph         paragraph = node.Item;

                Procedure procedure = Procedure.CreateDefault(Item.Procedures);
                Item.appendProcedures(procedure);
                procedure.FindOrCreateReqRef(paragraph);
            }
        }
        /// <summary>
        ///     Creates a rule and a rule condition in the procedure
        /// </summary>
        /// <param name="enclosing"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        protected RuleCondition CreateRuleAndCondition(Procedure enclosing, string name)
        {
            Rule rule = (Rule) Factory.createRule();
            enclosing.appendRules(rule);
            rule.Name = name;

            return CreateRuleCondition(rule, name);
        }
        /// <summary>
        ///     Creates a parameter in the enclosing procedure
        /// </summary>
        /// <param name="procedure"></param>
        /// <param name="name"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        protected Parameter CreateParameter(Procedure procedure, string name, string type)
        {
            Parameter retVal = (Parameter) Factory.createParameter();
            procedure.appendParameters(retVal);
            retVal.Name = name;
            retVal.TypeName = type;

            return retVal;
        }
예제 #14
0
        /// <summary>
        ///     Indicates that this rule has been defined in a procedure
        /// </summary>
        /// <returns></returns>
        public bool BelongsToAProcedure()
        {
            Procedure procedure = EnclosingFinder <Procedure> .find(this);

            return(procedure != null);
        }
 public void AddHandler(object sender, EventArgs args)
 {
     DataDictionary.Functions.Procedure procedure = (DataDictionary.Functions.Procedure)DataDictionary.Generated.acceptor.getFactory().createProcedure();
     procedure.Name = "<Procedure" + (GetNodeCount(false) + 1) + ">";
     AddProcedure(procedure);
 }
 /// <summary>
 ///     Constructor (for function)
 /// </summary>
 /// <param name="item"></param>
 /// <param name="buildSubNodes"></param>
 public ProcedureParametersTreeNode(Procedure item, bool buildSubNodes)
     : base(item, buildSubNodes, "Parameters", true, false)
 {
 }