Book a Demo

Author Topic: Create project browser  (Read 3523 times)

Virgil

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Create project browser
« on: March 18, 2009, 10:45:24 pm »
Hello!

I'm developing an add-in and I have to create a tree of packages, similar with the tree from the Project Browser. I'm using a recursive function that starts from the root package and adds all the packages to the tree. Unfortunately, this solution is a bit long.

Is there a faster way to do this? Thank you!

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Create project browser
« Reply #1 on: March 19, 2009, 02:35:19 am »
EA's API is slow, no way around it. All I can think of (except reading directly from the database) is to use lazy loading, i.e. only adding the root packages to the tree view and loading the next level when a node is being expanded.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Create project browser
« Reply #2 on: March 19, 2009, 09:14:22 am »
If the tree structure you're creating is the same every time you run your add-in, you could use EA.Project.ImportPackageXMI().
The Sparx Team
[email protected]

Virgil

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Create project browser
« Reply #3 on: March 19, 2009, 07:53:17 pm »
The tree contains all the packages in the project, so if a package is added or deleted, the structure changes. I will try Frank's solution.
Thank you for your answers!