Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: AdamK on November 19, 2012, 09:16:19 pm
-
Hello, I am developing an Add-in, and I had a problem refreshing the view of connector for the role name of the SupplierEnd.
The idea is to change the role name by a given string. However, when I changed the value of the Connector.SupplierEnd.Role, and refresh the connector and the diagram, it doesn't refresh the view but the value has been changed indeed. All I have to do is to double click the connector and click on "OK" to change the view of the name for the role.
What I want is to avoid mannually refreshing the view but doing everything in the automation. The code is as follows, could anyone help me with this? Thanks a lot!
-----------------------------------------------
EA.Connector outputConnector;
outputConnector = (EA.Connector)((EA.Element)outputObject).Connectors.GetAt(0);
outputConnector.SupplierEnd.Role = "ABC";
((dynamic)outputConnector.SupplierEnd).Update();
((dynamic)outputConnector).Update();
package.Elements.Refresh();
package.Diagrams.Refresh();
-----------------------------------------------
-
Adam,
Look at the documentation for the EA.Collection.Refresh(). It doesn't do what you think it does.
In your case you should use Repository.AdviseConnectorChange (
long ConnectorID) and possibly RefreshOpenDiagrams (
boolean FullReload)
Geert
-
Hi Geert,
You are right, I was doing it in a wrong way... And Repository.AdviseConnectorChange(long ConnectorID) works!
Thanks a lot for your help! ;)
Adam
Adam,
Look at the documentation for the EA.Collection.Refresh(). It doesn't do what you think it does.
In your case you should use Repository.AdviseConnectorChange (
long ConnectorID) and possibly RefreshOpenDiagrams (
boolean FullReload)
Geert