Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: stevesavage on February 03, 2017, 02:35:48 am

Title: Equivalent of Repository.GetTreeSelectedElements for Packages in List View?
Post by: stevesavage on February 03, 2017, 02:35:48 am
For one of my scripts I'd love to be able to do the following:


I don't think this is supported right now, but I thought I'd ask.

By the way, if you didn't know already, you can open multiple "list views" at the same time, and drag and drop elements between them... handy for organizing things in Sparx EA.
Title: Re: Equivalent of Repository.GetTreeSelectedElements for Packages in List View?
Post by: qwerty on February 03, 2017, 08:00:32 pm
The problem is that a script is running exclusively, so you can not pause it fo the user to do selection. The only way that comes to mind is to have two scripts. When time has come for the 2nd selection, the first script saves its context (the simplest would be to use a file here, but the registry or some tricky shared memory technique could be used as well). Now the use can do the selection and continue with the 2nd script reading the context from the saved storage.

q.
Title: Re: Equivalent of Repository.GetTreeSelectedElements for Packages in List View?
Post by: stevesavage on February 04, 2017, 01:06:51 am
Hi Query, I've discovered that calling Session.Prompt actually pauses script execution.
I already have a similar script working where I select Diagram Objects 

I use that script to select a set of Diagram Objects, then select Elements in the Project Browser, and then the script creates a trace relationships between the Diagram Objects and the Selected Elements.  The script creates the a trace relationship in the correct direction based on Element Types + Stereotypes.

I find this quicker than dragging to the diagram, or using a matrix in many cases.

I'd like to do the same between the Package Browser and the Package List View.