Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: chrissO 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.
-
I just tested and noticed the same thing. Looks like a bug to me.
Geert
-
Any idea of a workaround?
-
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
-
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.
Repository.ShowInProjectView(anyObj)
Repository.ShowInProjectView(neededObj)
BR
Andreas