Exemplo n.º 1
0
        /// <summary>
        /// Validates the model element.
        /// </summary>
        /// <param name="modelElement">The model element.</param>
        /// <param name="validationController">The validation controller.</param>
        /// <returns></returns>
        public static bool ValidateModelElement(ModelElement modelElement, ValidationController validationController)
        {
            Guard.ArgumentNotNull(modelElement, "modelElement");
            Guard.ArgumentNotNull(validationController, "validationController");

            bool isValid = true;
            HashSet <ModelElement> elementList   = new HashSet <ModelElement>();
            FullDepthElementWalker elementWalker =
                new FullDepthElementWalker(new ModelElementVisitor(elementList), new EmbeddingReferenceVisitorFilter(), false);

            elementWalker.DoTraverse(modelElement);
            validationController.ClearMessages();
            isValid = validationController.Validate(elementList, ValidationCategories.Menu);
            elementList.Clear();

            return(isValid);
        }
Exemplo n.º 2
0
		/// <summary>
		/// Validates the model element.
		/// </summary>
		/// <param name="modelElement">The model element.</param>
		/// <param name="validationController">The validation controller.</param>
		/// <returns></returns>
        public static bool ValidateModelElement(ModelElement modelElement, ValidationController validationController)
        {
            Guard.ArgumentNotNull(modelElement, "modelElement");
            Guard.ArgumentNotNull(validationController, "validationController");

            bool isValid = true;
            HashSet<ModelElement> elementList = new HashSet<ModelElement>();
            FullDepthElementWalker elementWalker =
                new FullDepthElementWalker(new ModelElementVisitor(elementList), new EmbeddingReferenceVisitorFilter(), false);

            elementWalker.DoTraverse(modelElement);
            validationController.ClearMessages();
            isValid = validationController.Validate(elementList, ValidationCategories.Menu);
            elementList.Clear();
            
            return isValid;
        }