Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: zalbina on June 03, 2013, 06:38:23 pm
-
Hello,
Yes, is it possible to built it in a simple way?
Thanks.
-
Forgot to mention "using API and C#"
-
Could you be a bit more specific?
q.
-
Sure. I need to show dialog box which contains EA Project Browser (like C# treeview control) and user selects any package he wants to work with. I began to write the code using treeview control which works fine in my case, but my concern is recursion. It takes too much time to find all those packages and subpackages and so on. Is it clear enough?
Thanks.
-
Not that I could help with Cxx programming (other might, though), but am I right that you have an EA-Add-in that wan't to take control (highjack) EA's project browser so the user can select a package (or whatever) and you get control back?
I doubt that would work.
Can't you use one of the OnContex... events to find out what had been selected to trigger whatever needs to be done?
q.
-
You are right, but I could not use the "click" in the EA Project Browser directly since I have separated window which called from my ea add-in. BUT you gave me some idea, thanks.
-
Try using Repository.InvokeConstructPicker.
See:
http://www.sparxsystems.com/enterprise_architect_user_guide/10/automation_and_scripting/repository3.html
int selectedID;
selectedID = repository.InvokeConstructPicker("IncludedTypes=Package;");
if (selectedID != 0)
{
EA.Element e = repository.GetElementByID(selectedID);
EA.Package selectedPackage = repository.GetPackageByGuid(e.ElementGUID);
}
-
A new one that is. Attention draw to it, I must.
q.
-
Added sometime around EA 9.0, I think.
-
I wrote my Scripting book based on 9.3 (build 930). But that method did not exist at that time. So either it was just missing in the help that time or it was introduced with 10.0.
q.
-
Oh, it's good to know.
Thanks a lot.
-
I wrote my Scripting book based on 9.3 (build 930). But that method did not exist at that time. So either it was just missing in the help that time or it was introduced with 10.0.
Correct. Looks like the method itself was introduced around EA 9, but only first appeared in the help documentation for EA 10.
-
2 remarks:
1) Yes indeed, if you need to select something, use the construct picker.
2) If you are building a treeview you shouldn't try to fetch the whole tree at the initialisation. I would suggest to only get the first level of packages, and then get the second level when a user actually opens a package. See the principle of "lazy loading".
Geert
-
You are right. This is effective way to build the tree. Thanks.