Author Topic: Where can we find Object_Type in UI of an element?  (Read 5171 times)

sravang

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Where can we find Object_Type in UI of an element?
« on: September 06, 2021, 04:02:46 pm »
Hello,

I am not able to find Object_Type of an element in UI inside properties of an element. I can see stereotype but not able to find object type. Can you suggest me where to look for it in UI

Thanks,
Sravan

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Where can we find Object_Type in UI of an element?
« Reply #1 on: September 06, 2021, 04:10:01 pm »
You can't. The actual object type has been hidden since v15.

The easiest way would be to use a query. You can do something like this:

Code: [Select]
Select o.Object_Type as myType from t_object o where o.ea_guid = '<paste the actual guid of the element>'
and execute that in the scratch pad. Make sure to use the alias, as EA will otherwise trick you and show the metatype of the element you are looking at instead.

Another method is to remove the stereotype and see what you end up with.

Geert

sravang

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Re: Where can we find Object_Type in UI of an element?
« Reply #2 on: September 06, 2021, 04:25:35 pm »
Hi Geert,

Thanks for your reply. Is there any way can I add one option on right click to display object_type through my c# addin?

Thanks,
Sravan

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Where can we find Object_Type in UI of an element?
« Reply #3 on: September 06, 2021, 06:28:57 pm »
Just issue the above SQL with repository.sqlquery and show its result.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Where can we find Object_Type in UI of an element?
« Reply #4 on: September 06, 2021, 06:35:54 pm »
Hi Geert,

Thanks for your reply. Is there any way can I add one option on right click to display object_type through my c# addin?

Thanks,
Sravan
Sure, using EA_GetMenuItems you should do that, or you could show that in your own add-in window for each selected element (a bit like my EA Navigator does)

Geert

sravang

  • EA User
  • **
  • Posts: 33
  • Karma: +0/-0
    • View Profile
Re: Where can we find Object_Type in UI of an element?
« Reply #5 on: September 06, 2021, 10:16:57 pm »
Hi Geert,

I have used Repository.GetContextObject() function to get current selected element, so that I can display object_type of that selected element. But this function throws an error when we select package or diagram. Is there any way so that we can use this function without any error and also one more help can we add this click under right click option of an element instead of our addin menu options.Right now it comes under specialize->Addin menu.

Thanks,
Sravan
« Last Edit: September 06, 2021, 10:24:29 pm by sravang »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Where can we find Object_Type in UI of an element?
« Reply #6 on: September 06, 2021, 10:28:06 pm »
You have to test the type of the returned object and act accordingly. I suspect the function itself doesn't throw an error, but your code tries to cast the returned object to EA.Element, even when getting a package (EA.Package) or diagram (EA.Diagram)

There is no way to add a context menu anywhere else than in the Specialize submenu.

Geert