Author Topic: Refreshing the view of Connector  (Read 4093 times)

AdamK

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Refreshing the view of Connector
« 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();
-----------------------------------------------
« Last Edit: November 19, 2012, 09:18:25 pm by Adam2012 »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13295
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Refreshing the view of Connector
« Reply #1 on: November 19, 2012, 10:29:54 pm »
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

AdamK

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Refreshing the view of Connector
« Reply #2 on: November 20, 2012, 09:12:32 am »
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


Quote
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