0
votes

I am working on Enterprise Architect C# Add - in. I am creating multiple packages and elements in the project browser.

I am using the Repository.ShowInProjectView() API to focus on an element in the project browser. Currently I require all the sub packages of the first package in the model to be expanded once the creation of elements is completed.

Is there an EA API available for the same. Kindly help. Thanks in advance.

2

2 Answers

1
votes

As @Arshad stated.

You can just write a recursive method to call Repository.ShowInProjectView() on each of the leaf sub-packages.

It would be like (in a meta-language)

func unfold(root) {
  if root.packages.count == 0 { 
    Repository.ShowInProjectView(root.element);
    return;
  }
  for subRoot in root.packages { unfold(subRoot); }
}

That will recurse through all sub-packages of a packages. When a leaf is reached it will be unfolded with Repository.ShowInProjectView (and all its parents too, of course).

To focus the first element of a package use

Repository.ShowInProjectView(package.elements.getat(0))
0
votes

There isn't any API calls available for expanding all the sub packages in project browser.