Author Topic: Refresh of Tagged-Values Window  (Read 3379 times)

chrissO

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Refresh of Tagged-Values Window
« on: June 20, 2018, 07:22:46 pm »
I am developing an EA Add-in where it is possible to change attributes of diagram elements.
The idea is to save the data entered in the Add-in (separate Window as Client) if the item is deselected by selecting another item.

The chronological order is: Select item1 and change attributes in the Add-in (Client) then select item2. After selecting item2 the changed data of item1 is saved in EA and the attributes of item2 can be edited in Add-in. The Tagged Values of the selected item are displayed in the Tagged Values Window of EA.

My problem occurs only if I deselect a Note(=item1) in the Diagram by selecting a Connector(=item2).

First problem: Message that another user possibly modified the diagram
Second problem: After avoiding above message the Tagged Values-Window of the selected Connector is empty

Problem1:
1) A Connector is selected and the Tagged Values of this Connector are displayed in the Tagged Values-Window .
2) Changes of  deselected Note are saved in EA via API.
3) The Connector is still selected and the Tagged Values displayed in the Tagged Values-Window .
But I get the message that another user possibly modified the diagram.

My solution of problem1 to avoid the message:
The following code is processed in EA_OnNotifyContextItemModified.

EA.ObjectType oType = repository.GetContextItem(out obj);
if (oType == EA.ObjectType.otConnector
{
       repository.RefreshOpenDiagrams(true);   //avoid message that another user possibly modified the diagram                                  
        repository.GetCurrentDiagram().SelectedConnector = (Connector)obj;
}

Problem2:
Immediately after repository.RefreshOpenDiagrams(true); the Tagged Values-Window  of the Connector is empty .
After “repository.GetCurrentDiagram().SelectedConnector = (Connector)obj;”  the Connector is selected, but  the Tagged Values-Window is still empty.

How can I refresh this Tagged Values-Window of the selected Connector via API?

I tried:
repository.GetCurrentDiagram().SelectedConnector.TaggedValues.Refresh();
But this does not help.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13065
  • Karma: +544/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Refresh of Tagged-Values Window
« Reply #1 on: June 20, 2018, 08:42:04 pm »
I just tested and noticed the same thing. Looks like a bug to me.

Geert

chrissO

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: Refresh of Tagged-Values Window
« Reply #2 on: June 20, 2018, 09:03:23 pm »
Any idea of a workaround?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13065
  • Karma: +544/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Refresh of Tagged-Values Window
« Reply #3 on: June 20, 2018, 09:34:25 pm »
Not really. Report the bug and wait for Sparx to fix it.
What you could try is the new method that centers the selected object to make it visible. Maybe that works better.

A long shot, but who knows...

Geert

AndiW.

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Refresh of Tagged-Values Window
« Reply #4 on: December 06, 2018, 02:00:03 am »
Hi,

as a workaround to get the tagged value window updated, select another element in the project browser and then switch back an select your element of interest. I use this method to update my tagged values window after modifing the tags by script.

Code: [Select]
Repository.ShowInProjectView(anyObj)
Repository.ShowInProjectView(neededObj)

BR
Andreas