Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Pavel Bunygin on April 24, 2015, 11:26:24 pm

Title: Action: how to get reference for CallBehavior
Post by: Pavel Bunygin on April 24, 2015, 11:26:24 pm
Hi!
I'm trying to find an element that selected in 'Behaviour' field of 'Call' tab for Action from my Add-In.

Can someone help with it?
(http://i.imgur.com/SlnmDcH.png)

Thanks in advance
Title: Re: Action: how to get reference for CallBehavior
Post by: Geert Bellekens on April 24, 2015, 11:48:08 pm
I implemented that for operations in the EA Navigator (http://bellekens.com/ea-navigator/)

If it is a CallOperationAction (https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework/blob/master/EAAddinFramework/EAWrappers/CallOperationAction.cs) then it does this:

Code: [Select]
       /// <summary>
        /// The operation to be invoked by the action execution.
        /// </summary>
        public UML.Classes.Kernel.Operation operation {
              get{
                    // first get the operations guid which is stored in the Classifier_guid column
                    XmlDocument operationGUIDxml = this.model.SQLQuery(@"select o.Classifier_guid from t_object o
                                                      where o.Object_ID = " + this.id.ToString());
                    XmlNode operationGUIDNode = operationGUIDxml.SelectSingleNode(this.model.formatXPath("//Classifier_guid"));
                  return this.model.getOperationByGUID(operationGUIDNode.InnerText);
              }
        }

I guess finding out a linked element must be rather similar.

Geert
Title: Re: Action: how to get reference for CallBehavior
Post by: Pavel Bunygin on April 24, 2015, 11:59:03 pm
You are a genious!
Thank you very much!

It is Element.ClassifierID  \ t_object.Classifier (Classifier_guid)