Book a Demo

Author Topic: Unwanted Side Efects When Changing ConnectorEnds  (Read 6266 times)

Slávek Rydval

  • EA User
  • **
  • Posts: 40
  • Karma: +2/-0
    • View Profile
    • homepage
Unwanted Side Efects When Changing ConnectorEnds
« on: March 11, 2017, 12:13:10 am »
I have a simple directed association between two classes. Then I change the c.ClientEnd.Navigable to "Non-Navigable" value within an addin method. As a side effect, EA changes connector's direction to the opposite one. Why?

The code in C#:


EA.Connector c = Repository.GetCurrentDiagram().SelectedConnector;
//now, the c.ClientEnd.Navigable == "Unspecified", c.SupplierEnd.Navigable == "Navigable" and c.Direction == "Source -> Destination"

c.ClientEnd.Navigable = "Non-Navigable";
//now, the c.ClientEnd.Navigable == "Non-Navigable", c.SupplierEnd.Navigable == "Navigable" and c.Direction == "Source -> Destination"

c.ClientEnd.Update();
//!!!now the value of c.Direction is "Destination->Source"!!!

c.Update();
Repository.SaveDiagram(Repository.GetCurrentDiagram().DiagramID);
Repository.ReloadDiagram(Repository.GetCurrentDiagram().DiagramID);


You get more side effects when you change OwnedByClassifier:

c.ClientEnd.OwnedByClassifier = true;
//direction and navigability is chagned


Is there any description how to proper change ConnectorEnds properties without these side effects?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Unwanted Side Efects When Changing ConnectorEnds
« Reply #1 on: March 11, 2017, 01:00:23 am »
Probably it's better to use Connector.Direction and change this accordingly. We don't expect any consistency in the API, do we?

q.

Slávek Rydval

  • EA User
  • **
  • Posts: 40
  • Karma: +2/-0
    • View Profile
    • homepage
Re: Unwanted Side Efects When Changing ConnectorEnds
« Reply #2 on: March 11, 2017, 07:11:21 am »
Well, in case of using OwnedByClassifier the bahaviour is less predicable. I have this dialog and accept the side effects would be a pain in the ass:



So again, is there any description how to properly use ConnectorEnds?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Unwanted Side Efects When Changing ConnectorEnds
« Reply #3 on: March 11, 2017, 08:37:25 am »
Again: Connector.Direction produces correct results. Only G. Sparks knows why ConnectorEnd has redundant functionality that does not work. Ah! Hey! This is EA! D'oh!

q.

Slávek Rydval

  • EA User
  • **
  • Posts: 40
  • Karma: +2/-0
    • View Profile
    • homepage
Re: Unwanted Side Efects When Changing ConnectorEnds
« Reply #4 on: March 12, 2017, 02:31:54 am »
Ok, cheers. I have to admin that there is wrong design of EA as many times before. :-(

For those who is interested in source code: https://github.com/SlavekRydval/GoatAssociations

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Unwanted Side Efects When Changing ConnectorEnds
« Reply #5 on: March 12, 2017, 03:01:54 am »
Strange enough (ah, not really) that the connector dialog is as clumsy as it is after so many years so people are urged to make their own dialogs.

q.