Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - z.kadlec

Pages: 1 [2]
16
Automation Interface, Add-Ins and Tools / Re: ShapeScript - print - addin
« on: February 22, 2012, 05:41:35 pm »
Well - it is as easy, as possible, thank to Sparx !!!  :)

The answer form them is:


-------------------

Hello Zdenek,

Sorry for the delay.

The "addin" property in shape scripts can be used to call a function provided by a custom EA add-in and print the string value returned by the add-in.


Enterprise Architect exposes an ActiveX / COM automation interface, allowing you to write an external application or Add-In to extend and automate Enterprise Architect functionality.
 
For more information on the automation interface (including full API reference), please refer to the help file included with Enterprise Architect.  The following link is to the online HTML version of this documentation:
http://www.sparxsystems.com/enterprise_architect_user_guide/9.0/automation/theautomationinterface.html
Some code samples are included in the installation directory with Enterprise Architect.  Additional code samples to help get started with writing EA add-ins can be found under the Resources area of the Sparx Systems website and on the EA Community web site.
http://www.sparxsystems.com/resources/developers/autint.html
http://community.sparxsystems.com/

Within your add-in you need to have a public function with an appropriate method signature that returns a string value. E.g. (C#)

public string GetValueForShape(EA.Repository Repository, string eaGuid, object theParams)

For example, your add-in function might return an element's name, stereotype, and alias in a single string...

Code: [Select]
     public string GetValueForShape(EA.Repository repository, string eaGuid, object theParams)
      {
            //Convert the parameters passed in into a string array.
            string[] args = (string[])theParams;
            
            //Get the element calling this addin
            EA.Element element = repository.GetElementByGuid(eaGuid);
            string ret = "";
            //Create the name modified element name
            if(args.Length > 0 && element != null)
            {
                  ret += element.Name;
                  
                  for(int i = 0; i < args.Length; i++)
                  {
                        if(args[i] == "Stereotype")
                              ret += " " + element.Stereotype;
                        
                        if(args[i] == "Alias")
                              ret += " " + element.Alias;
                  }
            }
            
            return ret;
      }
To call this function from a shape script would look like:

Code: [Select]
shape main
{
  //Draw the rect
  rectangle(0,0,100,100);
  //Replace CS_AddinFramework with your addin name and GetValueForShape with the function name you wish to call in your addin.
  print("#ADDIN:CS_AddinFramework, GetValueForShape, Stereotype, Alias#"); }

Best regards,
 
Aaron Bell
Sparx Systems Pty Ltd

17
Automation Interface, Add-Ins and Tools / ShapeScript - print - addin
« on: January 17, 2012, 11:11:21 am »
Dear all,

in shape-script documentation, in the section Display Element/Connector Properties in the help of EA (Standard UML Models->Define Modelling Language -> MDG Technology SDK -> Shap Script -> Write Scripts -> Display Element/Connector Properties...)

you can find:

"Properties for Element Shape Scripts
  
  • addin (value returned from an Add-In)
"

What does it mean? Would it be a way, how to put my own values into Shape Script?

I was not successful asking Uncle Google nor EA.Forum...

Thanks for any experience/example/explanation...

Zden[ch283]k

18
Hi,

is it possible to open the Search<item> dialog via automation interface?

I have some dialog in my add-in and I need to allow to the user to select some elements of specific stereotype... so I need to open some "element selector" form my code, wait to the element selection done by the user and then get the ElementID selected by client and use it somewhere in my application..


I tried to find it out in the automation interface, but I was not successfull.... :(

Thanks for your answer...

Zdene Kadlec

19
I have this one, but i VB6.0 and with czech comments...
(functions and variables are allmost in english, but the comments.... I'm sorry... And also the destription of how to use is poor and in czech...

I can store it somewhere, if you want, but... I have actually no time to translate it and write english tips how to use it...

It works as Add-In...

Z.Kadlec

20
Dears,

I have prepared plug-in implementing Broadcast Event :

Function EA_OnContextItemDoubleClicked(Repository As EA.Repository, GUID As String, ot As EA.ObjectType) As Boolean

If ot = otElement Then
   EA_OnContextItemDoubleClicked = openFormByType(Repository, Repository.GetElementByGuid(GUID))
ElseIf ot = otPackage Then
   EA_OnContextItemDoubleClicked = openFormByType(Repository, Repository.GetPackageByGuid(GUID))
ElseIf ot = otConnector Then
   EA_OnContextItemDoubleClicked = openFormByConnType(Repository, Repository.GetConnectorByGuid(GUID))
Else
   EA_OnContextItemDoubleClicked = False
   Repository.SuppressEADialogs = False
End If

End Function

This funciton call function openFormByType(…) which opens my dialog.

It works well, but if I would like to open this dialog in situation, when the name of the element is too long, then:
a)I select the element in repository
b)EA show „tool tip“ with whole name of element (the yellow box)
c)I doubleclick on the element (the tooltip is visible)
d)my plug-in opens the dialog (the tooltip is visible)
e)EA hides the tool tip with the element name (after some time period 1-2 sec)
f)=> EA shut down my plug-in and whole EA is in deadlock


If the name of the element is short and EA don’t show any tool tip, the plug-in has any problem and works well.

This error was also in EA 6.1.

Trick:
if before opening my dialog I open simply msgbox like:

msgbox "Hey, wait 3 seconds“

then if there is shown the tool tip with full name of the selected element, then after the tool tip is hidden, EA shuts down the msgbox. My plug-in continues with processing of my target form and evrithing is OK…but….it is not nice to explain to others, why they should wait 3 sec…

This is for me very crucial to solve this problem – we plan to use EA to model whole Bank processes, but we need do store more information about them (I use Tags) and we need to have our own form (simplification of data input – we have more then 1000 processes)

Thanks

Zdenek Kadlec
Business Process Architect
(I’m sorry for my english)

Pages: 1 [2]