Book a Demo

Author Topic: Creating a new view in EA from add-in  (Read 4122 times)

ron10023

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Creating a new view in EA from add-in
« on: March 19, 2008, 08:00:00 pm »
Hi everybody,

Is there a way to create a new view in EA, like Project Browser, from an add-in?

I'm writing the add-in in c# so if someone can give me an example, i'd appreciate it alot

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Creating a new view in EA from add-in
« Reply #1 on: March 19, 2008, 09:55:41 pm »
Hi Ron,

Yes, you can do this. You won't even need an example, since it is straightforward.

To EA, a view is any package that lives directly under a model root node.

[A model root is itself a package, although it has some minor differences, and the first model root in a project cannot be deleted. EA also treats root nodes differently in other ways.]

So, what you are doing is simply adding a new package (the view) to the Packages collection of an existing package (the model root).

First obtain a reference to the model root. This is easy to do; it is the first member of the Repository.Models() collection. Remember to type cast it to Package. Then use the AddNew method to add another package (your view).

You will end up with something like this:
Code: [Select]
Dim model As EA.Package
model = DirectCast(mRep.Models.GetAt(0S), EA.Package) ' Note that the index is a zero-based short integer!
dim myView as EA.Package
myView = DirectCast(model.Packages.AddNew("My View", "Package"), EA.Package)
myView.Update()
model.Packages.Refresh() ' In case you want to use GetAt or GetByName to reference this View
That should get you going.

David

BTW: There is some way that you can set the icon that EA uses in the Project Browser tree, but I simply don't remember where this is. Perhaps you can post back and let us know when you look it up.
No, you can't have it!

ron10023

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: Creating a new view in EA from add-in
« Reply #2 on: March 20, 2008, 01:02:38 am »
I think i was misunderstood in my question.

The EA software has several views like: Project Browser, Notes, Properties etc ( by views i mean the tabs in the software itself )

Is there a way to create something like that?

The AddTab method adds a tab in the main content area and that is not my intension

thomas.kilian

  • Guest
Re: Creating a new view in EA from add-in
« Reply #3 on: March 20, 2008, 02:35:20 am »
No.

Matt

  • EA User
  • **
  • Posts: 96
  • Karma: +0/-0
    • View Profile
    • Solutions Reality
Re: Creating a new view in EA from add-in
« Reply #4 on: April 17, 2008, 04:08:41 am »
We wanted to do something similar in Time Architect and found that there is no way to add extra windows/tabs into the EA workspace other than the AddTab approach.

We use this as the main window for TA.  However, we added a floating TA information window that we put the additional tabs that we need into...  Not quite as nice as fully integrating into EA - but it does the job :D

Regards,

Matt