Author Topic: Updating the projects treeview  (Read 3103 times)

Nik

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Updating the projects treeview
« on: March 24, 2009, 03:13:14 am »
Hello!

I have written an addin with c# for enterprise architect, where I can import elements and packages into a project. I can add them to a model and to the models packages with the addNew command, and then set the properties and call update on them. After they appear in the treeview only the name of element can be seen, and only by selecting an element or by restarting EA also the stereotype appears beside the name.
The same is with adding a new view. After it appers in the treeview, it looks like a normal package and only after restarting EA the specific icon of the view can be seen in the package icon.
So my question is how i can update the whole treeview after adding
new elements, packages and views?

with best regards, Nik

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Updating the projects treeview
« Reply #1 on: March 24, 2009, 03:43:59 am »
Hello Nik,

There are a few methods that might update your interface while your code is running. Try the Repository.RefreshModelView first, to see if this does what you need. If not, as long as you are there, try ReloadDiagram and RefreshOpenDiagrams (if your diagram is open). Perhaps EA will 'look at' the new elements more closely while doing this and update the tree.

Otherwise you can use the Project.ReloadProject method to completely reload the (currently open) project. This is strong medicine though, so try this route last.

David
No, you can't have it!

Nik

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Updating the projects treeview
« Reply #2 on: March 25, 2009, 12:06:01 am »
Thanks, the Repository.RefreshModelView worked great!