/// <summary>
        /// opens the CallOperationActions that call te selected operation
        /// </summary>
        private List <UML.UMLItem> getActions(UML.UMLItem parentElement)
        {
            List <UML.UMLItem> elementsToNavigate = new List <UML.UMLItem>();

            UML.Classes.Kernel.Operation selectedOperation = this.getSelectedOperation(parentElement);
            if (selectedOperation != null)
            {
                elementsToNavigate.AddRange(selectedOperation.getDependentCallOperationActions());
            }
            return(elementsToNavigate);
        }
        /// <summary>
        /// get all using diagrams for the given element
        /// currently only used for operations
        /// </summary>
        /// <param name="parentElement">the element</param>
        /// <returns>the diagrams using the given element</returns>
        private List <UML.UMLItem> getDiagrams(UML.UMLItem parentElement)
        {
            List <UML.UMLItem> elementsToNavigate = new List <UML.UMLItem>();

            UML.Classes.Kernel.Operation selectedOperation = this.getSelectedOperation(parentElement);

            if (selectedOperation != null)
            {
                elementsToNavigate.AddRange(selectedOperation.getUsingDiagrams <UML.Diagrams.Diagram>());
            }
            return(elementsToNavigate);
        }
        /// <summary>
        /// selects the implementation of the operation in the project browser, and opens all owned diagrams of the implementation.
        /// </summary>
        private List <UML.UMLItem> getImplementation(UML.UMLItem parentElement)
        {
            List <UML.UMLItem> elementsToNavigate = new List <UML.UMLItem>();

            UML.Classes.Kernel.Operation selectedOperation = this.getSelectedOperation(parentElement);
            if (selectedOperation != null)
            {
                foreach (UML.CommonBehaviors.BasicBehaviors.Behavior implementation in selectedOperation.methods)
                {
                    //select the behavior in the project browser
                    elementsToNavigate.AddRange(implementation.ownedDiagrams);
                }
            }
            return(elementsToNavigate);
        }
        /// <summary>
        /// Opens the types of the parameters of the selected operation
        /// </summary>
        private List <UML.UMLItem> getParameterTypes(UML.UMLItem parentElement)
        {
            List <UML.UMLItem> elementsToNavigate = new List <UML.UMLItem>();

            UML.Classes.Kernel.Operation selectedOperation = this.getSelectedOperation(parentElement);
            if (selectedOperation != null)
            {
                HashSet <UML.Classes.Kernel.Parameter> parameters = selectedOperation.ownedParameters;
                foreach (UML.Classes.Kernel.Parameter parameter in parameters)
                {
                    elementsToNavigate.Add(parameter.type);
                }
            }
            return(elementsToNavigate);
        }
        /// <summary>
        /// returns all operations called in this sequence diagram
        /// </summary>
        /// <returns>all operations called in this sequence diagram</returns>
        public List <UML.Classes.Kernel.Operation> getCalledOperations()
        {
            List <UML.Classes.Kernel.Operation> calledOperations = new List <UML.Classes.Kernel.Operation>();

            foreach (DiagramLinkWrapper linkwrapper in this.diagramLinkWrappers)
            {
                Message message = linkwrapper.relation as Message;
                if (message != null)
                {
                    UML.Classes.Kernel.Operation operation = message.calledOperation;
                    if (operation != null)
                    {
                        calledOperations.Add(operation);
                    }
                }
            }
            return(calledOperations);
        }
        /// <summary>
        /// Gets the selected operation from the model, either directly or through the selected message
        /// </summary>
        /// <returns>the selected operation, or the operation called by the selected message</returns>
        private UML.Classes.Kernel.Operation getSelectedOperation(UML.UMLItem parentElement)
        {
            // try if the the users selected an operation
            UML.Classes.Kernel.Operation selectedOperation = parentElement as UML.Classes.Kernel.Operation;
            //selected element is not an operation, try to get he operation from the selected message
            if (null == selectedOperation)
            {
                UML.Interactions.BasicInteractions.Message selectedMessage = parentElement as UML.Interactions.BasicInteractions.Message;

                if (null != selectedMessage)
                {
                    selectedOperation = selectedMessage.calledOperation;

                    if (selectedOperation == null)
                    {
                        System.Windows.Forms.MessageBox.Show("Could not find operation!\nMake sure you either select:\n-An Operation in the project browser \n-A message in a sequence diagram that calls an existing Operation"
                                                             , "Missing Operation!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                    }
                }
            }
            return(selectedOperation);
        }
        /// <summary>
        /// gets the operation for the parent element which can be
        /// - an operation itself
        /// - a message calling the operation
        /// - a parameter for an operation
        /// - a CallOperationAction
        /// </summary>
        /// <param name="parentElement">the element to get the operation from</param>
        /// <returns>the operation for this parent element</returns>
        private List <UML.UMLItem> getOperation(UML.UMLItem parentElement)
        {
            List <UML.UMLItem> elementsToNavigate = new List <UML.UMLItem>();

            UML.Classes.Kernel.Operation calledOperation = null;
            if (parentElement is UML.Classes.Kernel.Parameter)
            {
                calledOperation = ((UML.Classes.Kernel.Parameter)parentElement).operation;
            }
            else if (parentElement is UML.Actions.BasicActions.CallOperationAction)
            {
                calledOperation = ((UML.Actions.BasicActions.CallOperationAction)parentElement).operation;
            }
            else
            {
                calledOperation = this.getSelectedOperation(parentElement);
            }
            if (null != calledOperation)
            {
                elementsToNavigate.Add(calledOperation);
            }
            return(elementsToNavigate);
        }
示例#8
0
 private bool IsTrackedUmlItem(UML.UMLItem umlItem)
 {
     if (umlItem is UML.Classes.Kernel.Class)
     {
         UML.Classes.Kernel.Class classItem = umlItem as UML.Classes.Kernel.Class;
     }
     else if (umlItem is UML.Classes.Interfaces.Interface)
     {
         UML.Classes.Interfaces.Interface interfaceItem = umlItem as UML.Classes.Interfaces.Interface;
         if (HasSterotype(C_ExtStereotypes.funptr, interfaceItem.stereotypes))
         {
             return(true);
         }
     }
     else if (umlItem is UML.Classes.Kernel.Operation)
     {
         UML.Classes.Kernel.Operation opItem = umlItem as UML.Classes.Kernel.Operation;
         if (HasSterotype(C_ExtStereotypes.funptr, opItem.stereotypes))
         {
             return(true);
         }
     }
     return(false);
 }
示例#9
0
 private bool SynchronizeUmlItemTags(UML.Classes.Kernel.Operation opItem, ref string TagName, ref string TagValue, ref string TagNotes)
 {
     return(false);
 }