Book a Demo

Author Topic: OnPreDeleteConnector + Reload diagram crashes  (Read 3406 times)

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
OnPreDeleteConnector + Reload diagram crashes
« on: September 27, 2018, 06:34:51 pm »
Hi,

With a script, I update an element on a diagram when a connector is deleted. I'd like to reload the diagram to see the changes.
However since the trigger event is caught before deleting the connector, doing this crashes EA.

When creating a new connector it works because the event is OnPostNewConnector.

It would have been nice to have a PostDeleteConnector with the diagram ID and some of the deleted connector's details like its type, stereotype, + source & target object ids so I can refresh the diagram.
The only way round I can think of is to create a fake element to trigger a reload but I don't really like that.

Any comments on addressing this scenario so the user doesn't have to save & reload manually?

Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: OnPreDeleteConnector + Reload diagram crashes
« Reply #1 on: September 27, 2018, 06:48:11 pm »
I guess the common function of the Pre operations is to check whether the according operation is restricted. Any side effects will cause harm. So yes, there should be a Post for all variants. (From a design view a PostEdited telling the type of edit and eventually the original element value would make more sense.)

q.

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: OnPreDeleteConnector + Reload diagram crashes
« Reply #2 on: September 28, 2018, 01:02:03 am »
Note that I found that running a ReloadDiagram after the OnPostNewConnector in some instances makes EA crash.
I also tried running a SaveDiagram before and noticed it happens. I'm not sure there is a way to sort this so I unfortunately need to disable this automated diagram reload unless there's a way round.
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com