コード例 #1
0
        /// <summary>
        ///     Sets the state machine variable (and type)
        /// </summary>
        /// <param name="stateMachine">The state machine variable to display</param>
        /// <param name="stateMachineType">
        ///     The state machine type which should be displayed. If null, the default state machine is
        ///     displayed
        /// </param>
        public void SetStateMachine(IVariable stateMachine, StateMachine stateMachineType = null)
        {
            if (stateMachineType == null)
            {
                stateMachineType = stateMachine.Type as StateMachine;
            }

            if (stateMachineType != null)
            {
                Model = stateMachineType;
            }

            Model = Model;
            if (stateMachine != null)
            {
                StateMachineVariableExpression =
                    new Parser().Expression(EnclosingFinder <Dictionary> .find(stateMachine),
                                            stateMachine.FullName);
            }
            else
            {
                StateMachineVariableExpression = null;
            }
            RefreshControl();
        }
コード例 #2
0
        /// <summary>
        ///     Removes the prefix according to the StartRemove and EndRemove values
        /// </summary>
        /// <param name="treeNode">The tree node to replace</param>
        /// <param name="referencedElement">The element that should be replaced</param>
        /// <returns>if the replacement has been done</returns>
        private bool ReplaceNonTerminal(InterpreterTreeNode treeNode, ModelElement referencedElement)
        {
            bool retVal;

            if (ReplaceAllReferences)
            {
                // Only do the repleacement for elements defined in a dictionary
                retVal = EnclosingFinder <Dictionary> .find(referencedElement) != null;
            }
            else
            {
                // Check that the reference corresponds to the specific reference for this visitor
                retVal = referencedElement == Ref;
            }

            if (retVal)
            {
                // Removes the prefix
                if (ShouldRemovePrefix)
                {
                    ReplaceText("", StartRemove, EndRemove);
                    ResetRemoveIndexes();
                }

                string replacementValue = referencedElement.ReferenceName(User);
                ReplaceText(replacementValue, treeNode.Start, treeNode.End);
            }

            return(retVal);
        }
コード例 #3
0
ファイル: Window.cs プロジェクト: fakoor/ERTMSFormalSpecs
        /// <summary>
        ///     Allows to refresh the view, when the value of a model changed
        /// </summary>
        /// <param name="modelElement"></param>
        /// <param name="changeKind"></param>
        /// <returns>True if the view should be refreshed</returns>
        public override bool HandleValueChange(IModelElement modelElement, Context.ChangeKind changeKind)
        {
            bool retVal = base.HandleValueChange(modelElement, changeKind);

            if (retVal)
            {
                if (changeKind != Context.ChangeKind.EndOfCycle)
                {
                    modelDiagramPanel.RefreshControl();
                    if (stateDiagramPanel != null)
                    {
                        stateDiagramPanel.RefreshControl();
                    }

                    Dictionary enclosing = EnclosingFinder <Dictionary> .find(modelElement, true);

                    if (modelElement == null || enclosing == Dictionary)
                    {
                        dataDictTree.RefreshModel(modelElement);
                    }
                }
            }

            return(retVal);
        }
コード例 #4
0
        /// <summary>
        ///     Updates (if possible) the initial state for this transition
        /// </summary>
        /// <param name="initialBox"></param>
        public void SetInitialBox(IGraphicalDisplay initialBox)
        {
            State initialState = (State)initialBox;

            if (Action != null)
            {
                if (PreCondition != null)
                {
                    if (PreCondition.Rule == Action.Rule)
                    {
                        List <State> states = StateMachine.GetStates(PreCondition.Expression);
                        if (states.Count == 1)
                        {
                            PreCondition.ExpressionText = "THIS == " + initialState.FullName;
                            Source = initialState;
                        }
                        else
                        {
                            throw new CannotChangeRuleException("More than one state in the pre condition expression");
                        }
                    }
                    else
                    {
                        throw new CannotChangeRuleException("Precondition is not at the same level as the action");
                    }
                }
                else
                {
                    RuleCondition ruleCondition = Action.Enclosing as RuleCondition;
                    if (ruleCondition != null)
                    {
                        Rule rule = ruleCondition.EnclosingRule;

                        if (EnclosingFinder <State> .find(rule) == Source)
                        {
                            if (rule.RuleConditions.Count == 1)
                            {
                                Source.StateMachine.removeRules(rule);
                                Source = initialState;
                                Source.StateMachine.appendRules(rule);
                            }
                            else
                            {
                                rule.removeConditions(ruleCondition);
                                Source = initialState;
                                Rule newRule = (Rule)acceptor.getFactory().createRule();
                                newRule.Name = rule.Name;
                                newRule.appendConditions(ruleCondition);
                                Source.StateMachine.appendRules(newRule);
                            }
                        }
                        else
                        {
                            throw new CannotChangeRuleException("Action is not defined directly in the state");
                        }
                    }
                }
            }
            Source = initialState;
        }
コード例 #5
0
        /// <summary>
        ///     Indicates that the arrow should be displayed in the DEDUCED color
        /// </summary>
        /// <returns></returns>
        public override bool IsDeduced()
        {
            bool retVal = base.IsDeduced();

            if (!retVal)
            {
                if (TypedModel.GraphicalName.CompareTo(Transition.InitialTransitionName) != 0)
                {
                    StateMachine transitionStateMachine = EnclosingFinder <StateMachine> .find(TypedModel.RuleCondition);

                    if (transitionStateMachine == null)
                    {
                        // A deduced case is a arrow that is not defined in any state machine
                        retVal = true;
                    }
                    else
                    {
                        StatePanel panel = (StatePanel)Panel;
                        if (TypedModel.RuleCondition != null &&
                            panel.Model.Rules.Contains(TypedModel.RuleCondition.EnclosingRule))
                        {
                            // A deduced case is a arrow that is defined in the rules of the state machines (not in its states)
                            retVal = true;
                        }
                    }
                }
            }

            return(retVal);
        }
コード例 #6
0
        /// <summary>
        ///     The sub step relative to the mouse position
        /// </summary>
        /// <returns></returns>
        private SubStep SubStepRelatedToMousePosition()
        {
            SubStep retVal = null;

            ModelEvent evt = GetEventUnderMouse();

            if (evt != null && evt.Instance != null)
            {
                retVal = EnclosingFinder <SubStep> .find(evt.Instance as IEnclosed, true);

                if (retVal == null)
                {
                    Step step = evt.Instance as Step;
                    if (step != null && step.SubSteps.Count > 0)
                    {
                        retVal = (SubStep)step.SubSteps[step.SubSteps.Count - 1];
                    }
                }
            }

            if (retVal == null && Steps != null && Steps.Count > 0)
            {
                Step step = (Step)Steps[Steps.Count - 1];
                if (step.SubSteps.Count > 0)
                {
                    retVal = (SubStep)step.SubSteps[step.SubSteps.Count - 1];
                }
            }

            return(retVal);
        }
コード例 #7
0
ファイル: Counter.cs プロジェクト: fakoor/ERTMSFormalSpecs
        /// <summary>
        /// Counts the issues and the blocking issues
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="visitSubNodes"></param>
        public override void visit(Generated.ReferencesParagraph obj, bool visitSubNodes)
        {
            ReferencesParagraph referencesParagraph = obj as ReferencesParagraph;

            if (referencesParagraph != null)
            {
                foreach (ReqRef reqRef in referencesParagraph.Requirements)
                {
                    IssueKind?kind = IssueKindUtil.GetKind(reqRef.Paragraph);
                    if (kind != null)
                    {
                        Issues[(IssueKind)kind] += 1;
                        if (kind == IssueKind.Blocking)
                        {
                            SubSequence enclosingSubSequence = EnclosingFinder <SubSequence> .find(referencesParagraph,
                                                                                                   true);

                            if (enclosingSubSequence != null)
                            {
                                BlockingSubSequences.Add(enclosingSubSequence);
                            }
                        }
                    }
                }
            }

            base.visit(obj, visitSubNodes);
        }
コード例 #8
0
        public StandardValuesCollection GetValues(IModelElement element)
        {
            FinderRepository.INSTANCE.ClearCache();

            Dictionary dictionary = EnclosingFinder <Dictionary> .find(element);

            NameSpace nameSpace = EnclosingNameSpaceFinder.find(element);

            List <string> retVal = new List <string>();

            if (nameSpace != null)
            {
                OverallTypeFinder.INSTANCE.findAllValueNames("", nameSpace, true, retVal);
            }
            else
            {
                OverallTypeFinder.INSTANCE.findAllValueNames("", dictionary, false, retVal);
            }
            retVal.Sort();

            foreach (string name in dictionary.EFSSystem.PredefinedTypes.Keys)
            {
                retVal.Add(name);
            }

            return(new StandardValuesCollection(retVal));
        }
コード例 #9
0
            /// <summary>
            ///     Update references to paragraphs
            /// </summary>
            /// <param name="obj"></param>
            /// <param name="visitSubNodes"></param>
            public override void visit(Generated.ReqRef obj, bool visitSubNodes)
            {
                ReqRef reqRef = (ReqRef)obj;

                if (UpdateGuid)
                {
                    Specification.Paragraph paragraph = reqRef.Paragraph;
                    if (paragraph != null)
                    {
                        // Updates the paragraph Guid
                        if (paragraph.Guid != reqRef.getId())
                        {
                            reqRef.setId(paragraph.getGuid());
                        }

                        // Updates the specification Guid
                        Specification.Specification specification =
                            EnclosingFinder <Specification.Specification> .find(paragraph);

                        if (specification.Guid != reqRef.getSpecId())
                        {
                            reqRef.setSpecId(specification.Guid);
                        }
                    }
                }

                base.visit(obj, visitSubNodes);
            }
コード例 #10
0
        /// <summary>
        ///     Allows to refresh the view, when the value of a model changed
        /// </summary>
        /// <param name="modelElement"></param>
        /// <param name="changeKind"></param>
        /// <returns>True if the view should be refreshed</returns>
        public override bool HandleValueChange(IModelElement modelElement, Context.ChangeKind changeKind)
        {
            bool retVal = base.HandleValueChange(modelElement, changeKind);

            if (retVal)
            {
                if (Variable != null)
                {
                    Expression expression = new Parser().Expression(
                        EnclosingFinder <Dictionary> .find(Variable), Variable.FullName);
                    IVariable variable = expression.GetVariable(new InterpretationContext());
                    if (variable != Variable)
                    {
                        SetVariable(variable);
                    }
                    else
                    {
                        structureTreeListView.RefreshObject(Variable);
                        structureTreeListView.Refresh();
                    }
                }
            }

            return(retVal);
        }
コード例 #11
0
ファイル: Window.cs プロジェクト: fakoor/ERTMSFormalSpecs
        /// <summary>
        ///     Indicates that the model element should be displayed
        /// </summary>
        /// <param name="modelElement"></param>
        /// <returns></returns>
        protected override bool ShouldTrackSelectionChange(IModelElement modelElement)
        {
            bool retVal = base.ShouldTrackSelectionChange(modelElement);

            if (retVal)
            {
                // Don't handle shortcuts in history
                retVal = EnclosingFinder <ShortcutDictionary> .find(modelElement, true) == null;
            }

            return(retVal);
        }
コード例 #12
0
ファイル: Window.cs プロジェクト: fakoor/ERTMSFormalSpecs
        /// <summary>
        ///     Indicates that the model element should be displayed
        /// </summary>
        /// <param name="modelElement"></param>
        /// <returns></returns>
        protected override bool ShouldTrackSelectionChange(IModelElement modelElement)
        {
            bool retVal = base.ShouldTrackSelectionChange(modelElement);

            if (retVal)
            {
                NameSpace nameSpace = EnclosingFinder <NameSpace> .find(modelElement, true);

                retVal = nameSpace != null || modelElement == Dictionary;
            }

            return(retVal);
        }
コード例 #13
0
        /// <summary>
        ///     Provides the description of the requirements related to this model element
        /// </summary>
        /// <returns></returns>
        public virtual string RequirementDescription()
        {
            string retVal = "";

            ReqRelated reqRelated = EnclosingFinder <ReqRelated> .find(this, true);

            if (reqRelated != null)
            {
                retVal = reqRelated.RequirementDescription();
            }

            return(retVal);
        }
コード例 #14
0
ファイル: Window.cs プロジェクト: fakoor/ERTMSFormalSpecs
        /// <summary>
        /// Provides the Namespace or the Dictionary enclosing the element in the context
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private static IModelElement DisplayedElementInModelDiagramPanel(Context.SelectionContext context)
        {
            IModelElement model = null;

            // ReSharper disable once ConditionIsAlwaysTrueOrFalse
            if (model == null)
            {
                model = EnclosingFinder <Function> .find(context.Element, true);
            }

            if (model == null)
            {
                model = EnclosingFinder <RuleCondition> .find(context.Element, true);
            }

            if (model == null)
            {
                model = EnclosingFinder <Rule> .find(context.Element, true);
            }

            if (model == null)
            {
                model = EnclosingFinder <Procedure> .find(context.Element, true);
            }

            if (model == null)
            {
                model = EnclosingFinder <Structure> .find(context.Element, true);
            }

            if (model == null)
            {
                model = EnclosingFinder <Range> .find(context.Element, true);
            }

            if (model == null)
            {
                model = EnclosingFinder <DataDictionary.Types.Enum> .find(context.Element, true);
            }

            if (model == null)
            {
                model = EnclosingFinder <NameSpace> .find(context.Element, true);
            }

            if (model == null)
            {
                model = EnclosingFinder <Dictionary> .find(context.Element, true);
            }
            return(model);
        }
コード例 #15
0
ファイル: BaseForm.cs プロジェクト: fakoor/ERTMSFormalSpecs
        /// <summary>
        ///     Indicates that a change event should be displayed
        /// </summary>
        /// <param name="modelElement"></param>
        /// <param name="changeKind"></param>
        /// <returns></returns>
        protected virtual bool ShouldDisplayChange(IModelElement modelElement, Context.ChangeKind changeKind)
        {
            bool retVal = true;

            // When end of cycle, only redisplay when the displayed element related to a variable
            if (changeKind == Context.ChangeKind.EndOfCycle)
            {
                IVariable variable = EnclosingFinder <IVariable> .find(DisplayedModel, true);

                retVal = (variable != null);
            }

            return(retVal);
        }
コード例 #16
0
        /// <summary>
        ///     Indicates whether we need to keep this event during garbage collection
        /// </summary>
        /// <param name="evt"></param>
        /// <returns></returns>
        private bool KeepEvent(ModelEvent evt)
        {
            bool retVal = evt is Expect ||
                          evt is ModelInterpretationFailure ||
                          evt is SubStepActivated;

            VariableUpdate update = evt as VariableUpdate;

            if (update != null)
            {
                retVal = EnclosingFinder <NameSpace> .find(update.Action) == null;
            }

            return(retVal);
        }
コード例 #17
0
        /// <summary>
        ///     Provides the set of rules which uses this variable
        /// </summary>
        /// <param name="node">the element to find in rules</param>
        /// <returns>the list of rules which use the element provided</returns>
        public static HashSet <RuleCondition> RulesUsingThisElement(IVariable node)
        {
            UsageVisitor visitor = new UsageVisitor(node);

            EfsSystem efsSystem = EnclosingFinder <EfsSystem> .find(node);

            if (efsSystem != null)
            {
                foreach (Dictionary dictionary in efsSystem.Dictionaries)
                {
                    visitor.visit(dictionary);
                }
            }

            return(visitor.Usages);
        }
コード例 #18
0
        /// <summary>
        ///     Refactors an element which has a type
        /// </summary>
        /// <param name="element">The element that has been modified</param>
        /// <param name="user">The user which references this type</param>
        private static void RefactorTypedElement(ModelElement element, ITypedElement user)
        {
            if (user != null)
            {
                try
                {
                    ModelElement enclosing = EnclosingFinder <NameSpace> .find(user, true);

                    Function function = user as Function;
                    if (function != null)
                    {
                        bool refactor = false;
                        Type current  = function.ReturnType;
                        while (current != null && !refactor)
                        {
                            refactor = current == element;
                            current  = EnclosingFinder <Type> .find(current);
                        }

                        if (refactor)
                        {
                            function.TypeName = function.ReturnType.ReferenceName(enclosing);
                        }
                    }
                    else
                    {
                        bool refactor = false;
                        Type current  = user.Type;
                        while (current != null && !refactor)
                        {
                            refactor = current == element;
                            current  = EnclosingFinder <Type> .find(current);
                        }

                        if (refactor)
                        {
                            user.TypeName = user.Type.ReferenceName(enclosing);
                        }
                    }
                }
                catch (Exception e)
                {
                    ((ModelElement)user).AddError("Cannot refactor this element, reason = " + e.Message);
                }
            }
        }
コード例 #19
0
            public override void visit(BaseModelElement obj, bool visitSubNodes)
            {
                IExpressionable expressionnable = obj as IExpressionable;

                if (expressionnable != null)
                {
                    Function enclosingFunction = EnclosingFinder <Function> .find(obj, true);

                    if (enclosingFunction != null)
                    {
                        // The value of the function depends on this.
                        TheReferenceVisitor.UpdateReferences(enclosingFunction, expressionnable.Tree);
                    }
                }

                base.visit(obj, visitSubNodes);
            }
コード例 #20
0
        /// <summary>
        ///     Adds a new element log attached to this model element
        /// </summary>
        /// <param name="log"></param>
        public override void AddElementLog(ElementLog log)
        {
            if (!BeSilent)
            {
                Parameter enclosingParameter = EnclosingFinder <Parameter> .find(this);

                if (enclosingParameter != null)
                {
                    log.Log = "In " + FullName + ":" + log.Log;
                    enclosingParameter.AddElementLog(log);
                }
                else
                {
                    base.AddElementLog(log);
                    EFSSystem.Context.HandleInfoMessageChangeEvent(this);
                }
            }
        }
コード例 #21
0
        /// <summary>
        ///     Constructor
        /// </summary>
        /// <param name="folder"></param>
        /// <param name="buildSubNodes"></param>
        public UsageTreeNode(IModelElement folder, bool buildSubNodes)
            : base(null, buildSubNodes, folder.Name)
        {
            Usage         = null;
            FolderElement = folder;
            ToolTipText   = folder.FullName;

            NameSpace nameSpace = EnclosingFinder <NameSpace> .find(folder, true);

            if (nameSpace != null)
            {
                ChangeImageIndex(BaseTreeView.ModelImageIndex);
            }
            else
            {
                ChangeImageIndex(BaseTreeView.TestImageIndex);
            }
        }
コード例 #22
0
        /// <summary>
        /// Selects the graphical element for the model provided
        /// </summary>
        /// <param name="model"></param>
        public override void SelectModel(object model)
        {
            RuleCondition ruleCondition = EnclosingFinder <RuleCondition> .find(model as IModelElement, true);

            if (ruleCondition != null)
            {
                base.SelectModel(ruleCondition);
            }
            else
            {
                State state = EnclosingFinder <State> .find(model as IModelElement, true);

                if (state != null)
                {
                    base.SelectModel(state);
                }
            }
        }
コード例 #23
0
        /// <summary>
        ///     Adds a rule check message on the corresponding model element
        /// </summary>
        /// <param name="id"></param>
        /// <param name="level"></param>
        /// <param name="message"></param>
        public void AddRuleCheckMessage(RuleChecksEnum id, ElementLog.LevelEnum level, string message)
        {
            bool enabled = true;
            IRuleCheckDisabling ruleCheckDisabling = EnclosingFinder <IRuleCheckDisabling> .find(this, true);

            while (enabled && ruleCheckDisabling != null)
            {
                if (ruleCheckDisabling.Disabling != null)
                {
                    enabled = ruleCheckDisabling.Disabling.Enabled(id);
                }
                ruleCheckDisabling = EnclosingFinder <IRuleCheckDisabling> .find(ruleCheckDisabling as IEnclosed, false);
            }

            if (enabled)
            {
                AddElementLog(new ElementLog(level, id + ": " + message));
            }
        }
コード例 #24
0
ファイル: Window.cs プロジェクト: fakoor/ERTMSFormalSpecs
        /// <summary>
        ///     Indicates that a change event should be displayed
        /// </summary>
        /// <param name="modelElement"></param>
        /// <param name="changeKind"></param>
        /// <returns></returns>
        protected override bool ShouldDisplayChange(IModelElement modelElement, Context.ChangeKind changeKind)
        {
            bool retVal = modelElement == null;

            if (!retVal)
            {
                if (changeKind != Context.ChangeKind.EndOfCycle)
                {
                    Dictionary enclosing = EnclosingFinder <Dictionary> .find(modelElement, true);

                    retVal = (enclosing == Dictionary);
                }
                else
                {
                    retVal = base.ShouldDisplayChange(modelElement, changeKind);
                }
            }

            return(retVal);
        }
コード例 #25
0
        /// <summary>
        ///     Called when the drop operation is performed on a node
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DragDropHandler(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent("WindowsForms10PersistentObject", false))
            {
                Point        pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y));
                BaseTreeNode destinationNode = (BaseTreeNode)((BaseTreeView)sender).GetNodeAt(pt);
                object       data            = e.Data.GetData("WindowsForms10PersistentObject");
                BaseTreeNode sourceNode      = data as BaseTreeNode;
                if (sourceNode != null && destinationNode != null)
                {
                    if ((e.KeyState & Ctrl) != 0)
                    {
                        destinationNode.AcceptCopy(sourceNode);
                    }
                    else if ((e.KeyState & Alt) != 0)
                    {
                        destinationNode.AcceptMove(sourceNode);
                    }
                    else
                    {
                        destinationNode.AcceptDrop(sourceNode);
                        if (Refactor && Settings.Default.AllowRefactor)
                        {
                            NameSpace nameSpace = EnclosingFinder <NameSpace> .find(sourceNode.Model, true);

                            if (nameSpace != null)
                            {
                                // Only apply refactoring when dropping Model Element items
                                // This is useless for Requirements, and test related elements
                                RefactorAndRelocateOperation refactorAndRelocate =
                                    new RefactorAndRelocateOperation(sourceNode.Model as ModelElement);
                                refactorAndRelocate.ExecuteUsingProgressDialog(GuiUtils.MdiWindow, "Refactoring", false);
                            }
                        }
                    }
                }
            }
        }
コード例 #26
0
        /// <summary>
        ///     Provides the set of covered requirements by the model
        /// </summary>
        /// <param name="aDictionary">The model</param>
        /// <param name="covered">Indicates if we need compute covered or non covered requirements</param>
        /// <returns></returns>
        public static HashSet <Paragraph> CoveredRequirements(Dictionary aDictionary, bool covered)
        {
            HashSet <Paragraph> retVal = new HashSet <Paragraph>();

            ICollection <Paragraph> applicableParagraphs = aDictionary.ApplicableParagraphs;
            Dictionary <Paragraph, List <ReqRef> > paragraphsReqRefDictionary = aDictionary.ParagraphsReqRefs;

            foreach (Paragraph paragraph in applicableParagraphs)
            {
                bool implemented = paragraph.getImplementationStatus() ==
                                   acceptor.SPEC_IMPLEMENTED_ENUM.Impl_Implemented;
                if (implemented)
                {
                    if (paragraphsReqRefDictionary.ContainsKey(paragraph))
                    {
                        List <ReqRef> implementations = paragraphsReqRefDictionary[paragraph];
                        for (int i = 0; i < implementations.Count; i++)
                        {
                            // the implementation may be also a ReqRef
                            if (implementations[i].Enclosing is ReqRelated)
                            {
                                ReqRelated reqRelated = implementations[i].Enclosing as ReqRelated;
                                // Do not consider tests
                                if (EnclosingFinder <Frame> .find(reqRelated) == null)
                                {
                                    implemented = implemented && reqRelated.ImplementationCompleted;
                                }
                            }
                        }
                    }
                }
                if (implemented == covered)
                {
                    retVal.Add(paragraph);
                }
            }
            return(retVal);
        }
コード例 #27
0
ファイル: Window.cs プロジェクト: fakoor/ERTMSFormalSpecs
        /// <summary>
        ///     Refreshes the displayed model
        /// </summary>
        private void RefreshModel()
        {
            specBrowserRuleView.Nodes.Clear();
            Paragraph paragraph = EnclosingFinder <Paragraph> .find(DisplayedModel, true);

            if (paragraph == null)
            {
                ReqRef reqRef = DisplayedModel as ReqRef;
                if (reqRef != null)
                {
                    paragraph = reqRef.Paragraph;
                }
            }
            if (paragraph != null)
            {
                foreach (ReqRef reqRef in paragraph.Implementations)
                {
                    specBrowserRuleView.Nodes.Add(new ReqRefTreeNode(reqRef, true, false, reqRef.Model.Name));
                }

                functionalBlocksTreeView.SetRoot(paragraph);
            }
            specBrowserTreeView.RefreshModel(null);
        }
コード例 #28
0
        /// <summary>
        ///     Allows to refresh the view, when the value of a model changed
        /// </summary>
        /// <param name="modelElement"></param>
        /// <param name="changeKind"></param>
        /// <returns>True if the view should be refreshed</returns>
        public override bool HandleValueChange(IModelElement modelElement, Context.ChangeKind changeKind)
        {
            bool retVal = base.HandleValueChange(modelElement, changeKind);

            if (retVal)
            {
                if (modelElement == null)
                {
                    BoxArrowContainerPanel.RefreshControl();
                }
                else
                {
                    TEnclosing enclosing = EnclosingFinder <TEnclosing> .find(modelElement, true);

                    while (enclosing != null)
                    {
                        if (enclosing == Model)
                        {
                            BoxArrowContainerPanel.RefreshControl();
                            enclosing = null;
                        }
                        else
                        {
                            enclosing = EnclosingFinder <TEnclosing> .find(enclosing as IEnclosed, false);
                        }
                    }
                }
            }

            if (changeKind == Context.ChangeKind.EndOfCycle)
            {
                BoxArrowContainerPanel.Refresh();
            }

            return(retVal);
        }
コード例 #29
0
        /// <summary>
        /// Describes a specific Subset-076 specification issue
        /// </summary>
        /// <param name="paragraph"></param>
        private void DescribeSpecIssue(Paragraph paragraph)
        {
            if (paragraph.SubParagraphs.Count > 0)
            {
                Report.AddSubParagraph(paragraph.Name);
                Report.AddTable(new[] { "SubSequence", "Test case", "Step", "Comment" }, new[] { 60, 20, 10, 80 });
                foreach (Paragraph subParagraph in paragraph.SubParagraphs)
                {
                    DescribeSpecIssue(subParagraph);
                }
                Report.CloseSubParagraph();
            }
            else
            {
                Report.AddRow(paragraph.ExpressionText);
                Report.SetLastRowColor(IssueColor(paragraph));

                if (paragraph.Implementations.Count > 0)
                {
                    foreach (ReqRef reqRef in paragraph.Implementations)
                    {
                        SubSequence subSequence = EnclosingFinder <SubSequence> .find(reqRef, true);

                        TestCase testCase = EnclosingFinder <TestCase> .find(reqRef, true);

                        Step step = EnclosingFinder <Step> .find(reqRef, true);

                        Report.AddRow(
                            subSequence != null ? subSequence.Name : "",
                            testCase != null ? testCase.getFeature().ToString(CultureInfo.InvariantCulture) : "",
                            step != null ? step.getTCS_Order().ToString(CultureInfo.InvariantCulture) : "",
                            reqRef.Comment);
                    }
                }
            }
        }
コード例 #30
0
ファイル: Window.cs プロジェクト: fakoor/ERTMSFormalSpecs
        /// <summary>
        /// Provides the state machine from the context
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private static StateMachine GetStateMachine(Context.SelectionContext context)
        {
            StateMachine stateMachine;

            State state = EnclosingFinder <State> .find(context.Element, true);

            if (state != null && state.StateMachine.countStates() > 0)
            {
                stateMachine = state.StateMachine;
            }
            else
            {
                stateMachine = EnclosingFinder <StateMachine> .find(context.Element, true);
            }

            IVariable variable = context.Element as IVariable;

            if (variable != null)
            {
                stateMachine = variable.Type as StateMachine;
            }

            return(stateMachine);
        }