Author Topic: EA Project Browser in regular windows form  (Read 7228 times)

zalbina

  • EA User
  • **
  • Posts: 149
  • Karma: +0/-0
    • View Profile
EA Project Browser in regular windows form
« on: June 03, 2013, 06:38:23 pm »
Hello,

Yes, is it possible to built it in a simple way?

Thanks.

zalbina

  • EA User
  • **
  • Posts: 149
  • Karma: +0/-0
    • View Profile
Re: EA Project Browser in regular windows form
« Reply #1 on: June 03, 2013, 07:13:34 pm »
Forgot to mention "using API and C#"

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: EA Project Browser in regular windows form
« Reply #2 on: June 03, 2013, 07:36:36 pm »
Could you be a bit more specific?

q.

zalbina

  • EA User
  • **
  • Posts: 149
  • Karma: +0/-0
    • View Profile
Re: EA Project Browser in regular windows form
« Reply #3 on: June 03, 2013, 08:01:19 pm »
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.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: EA Project Browser in regular windows form
« Reply #4 on: June 03, 2013, 08:10:11 pm »
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.

zalbina

  • EA User
  • **
  • Posts: 149
  • Karma: +0/-0
    • View Profile
Re: EA Project Browser in regular windows form
« Reply #5 on: June 03, 2013, 08:20:54 pm »
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.

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: EA Project Browser in regular windows form
« Reply #6 on: June 04, 2013, 09:57:10 am »
Try using Repository.InvokeConstructPicker.

See:
http://www.sparxsystems.com/enterprise_architect_user_guide/10/automation_and_scripting/repository3.html

Code: [Select]
int selectedID;
selectedID = repository.InvokeConstructPicker("IncludedTypes=Package;");
if (selectedID != 0)
{
    EA.Element e = repository.GetElementByID(selectedID);
    EA.Package selectedPackage = repository.GetPackageByGuid(e.ElementGUID);
}

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: EA Project Browser in regular windows form
« Reply #7 on: June 04, 2013, 10:19:01 am »
A new one that is. Attention draw to it, I must.

q.

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: EA Project Browser in regular windows form
« Reply #8 on: June 04, 2013, 10:52:27 am »
Added sometime around EA 9.0, I think.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: EA Project Browser in regular windows form
« Reply #9 on: June 04, 2013, 08:25:29 pm »
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.

zalbina

  • EA User
  • **
  • Posts: 149
  • Karma: +0/-0
    • View Profile
Re: EA Project Browser in regular windows form
« Reply #10 on: June 05, 2013, 12:23:34 am »
Oh, it's good to know.

Thanks a lot.

Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: EA Project Browser in regular windows form
« Reply #11 on: June 05, 2013, 10:34:36 am »
Quote
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.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA Project Browser in regular windows form
« Reply #12 on: June 06, 2013, 05:10:33 pm »
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

zalbina

  • EA User
  • **
  • Posts: 149
  • Karma: +0/-0
    • View Profile
Re: EA Project Browser in regular windows form
« Reply #13 on: June 06, 2013, 10:33:23 pm »
You are right. This is effective way to build the tree. Thanks.