Book a Demo

Author Topic: EA Project Glossary in the Add-In  (Read 5969 times)

Dobrin

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
EA Project Glossary in the Add-In
« on: August 07, 2014, 07:48:14 pm »
Hello all,

I want to integrate a Project Glossary in an Add-In. Is that possible?

e.g I have an exported Glossary.xml file and I want to integrate it in the add-in so that it will be available for multiple projects.

Thank you in advance for your answer(s)!

Gruß,
Dobrin


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA Project Glossary in the Add-In
« Reply #1 on: August 07, 2014, 08:59:00 pm »
Yes

You can .
Here's what I use in my Excel importer
Code: [Select]
'-------------------------------------------------------------
' Author:   Geert Bellekens
' Date:     30/04/2013
' Description: adds or updates the Term with the given type,name
'   and meaning in the Glossary.
'-------------------------------------------------------------
Public Function addOrUpdateTerm(name As String, termType As String, meaning As String) As EA.Term
    Dim myTerm As EA.Term
    'try to find existing Term with the given name
    Set myTerm = getTermByName(name)
    If myTerm Is Nothing Then
        'no existing Term, create new
        Set myTerm = EARepos.Terms.AddNew(name, termType)
    End If
    'set properties
    myTerm.Type = termType
    myTerm.meaning = meaning
    'save Term
    myTerm.Update
    'refresh glossary collection
    EARepos.Terms.Refresh
    'return Term
    Set addOrUpdateTerm = myTerm
End Function
« Last Edit: August 07, 2014, 09:00:45 pm by Geert.Bellekens »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: EA Project Glossary in the Add-In
« Reply #2 on: August 07, 2014, 08:59:03 pm »
You can import the XML via
Code: [Select]
xmlres = Respository.CustomCommand("Repository", "ImportRefData", sXML);It is also possible to fiddle around with the table t_glossary directly by using Repository.SQLQuery for reading and Repository.Execute for modifying it.

q.

Dobrin

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: EA Project Glossary in the Add-In
« Reply #3 on: August 07, 2014, 09:32:39 pm »
Thank you guys. I'll try that and keep you posted.
Dobrin.

Dobrin

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: EA Project Glossary in the Add-In
« Reply #4 on: August 08, 2014, 01:09:43 am »
Quote
Thank you guys. I'll try that and keep you posted.
Dobrin.

I do not know if I have formulated the correct question..
So I only want to install an existing glossary.xml file so that it will be available for all the projects.
Is there any way to do that using C# add-in for EA? Do I have to parse all the file to retrieve the type, meaning, etc... and then create new terms?

Is there a way to call the "Import Reference Data" from Project--> Model Import / Export ?

Thanks,
Dobrin

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: EA Project Glossary in the Add-In
« Reply #5 on: August 08, 2014, 02:08:12 am »
Sure. It's a menu option. Right where you exported it.

q.
« Last Edit: August 08, 2014, 02:08:45 am by qwerty »

Dobrin

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: EA Project Glossary in the Add-In
« Reply #6 on: August 08, 2014, 03:37:25 pm »
Quote
Sure. It's a menu option. Right where you exported it.

q.

Yes, that I knwew.
You can acces the EA menu from the Add-in in order to do that each time project is opened (e.g on EA_Connect function)?

Dobrin

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: EA Project Glossary in the Add-In
« Reply #7 on: August 08, 2014, 06:57:56 pm »
There is no API to control what is in the menus. Just (some/most?) functions are also available via API. E.g. you can import reference data like described above. For other menus you'd need to hack Windoze (IIRC there's a thread where someone described how he did that). You may catch the EA_FileOpen event in order to perform things when a repository is opened.

I wonder if that makes sense for the glossary. It's loaded once and only if a new version is available it should be reloaded. So definitely not at each opening. If you use a shared model it wouldn't make sense anyway.

q.

Dobrin

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: EA Project Glossary in the Add-In
« Reply #8 on: August 08, 2014, 07:07:13 pm »
Quote
There is no API to control what is in the menus. Just (some/most?) functions are also available via API. E.g. you can import reference data like described above. For other menus you'd need to hack Windoze (IIRC there's a thread where someone described how he did that). You may catch the EA_FileOpen event in order to perform things when a repository is opened.

I wonder if that makes sense for the glossary. It's loaded once and only if a new version is available it should be reloaded. So definitely not at each opening. If you use a shared model it wouldn't make sense anyway.

q.

So then I could use the above method to import the glossary into the add-in and after that, parse the data in order to add new terms in the dictionary?

Yes the glossary will be loaded once, and then maintained.. so I do not need to do this all the time.

Thanks,
Dobrin

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: EA Project Glossary in the Add-In
« Reply #9 on: August 08, 2014, 07:57:01 pm »
The method in my first post will read the entire glossary as the Import menu would have done. You supply the XML as string parameter.

q.
« Last Edit: August 08, 2014, 07:57:17 pm by qwerty »