Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Ian Mitchell on January 21, 2020, 04:54:53 am

Title: EA_OnPreNewElement - duplicate events ?
Post by: Ian Mitchell on January 21, 2020, 04:54:53 am
My addin is looking at elements being added to a diagram, and responding to the broadcast events, but I seem to be getting a duplicate event.

(these test cases were done is a simple 'hello world' addin, with no additional function)

In the simple scenario, all is well:
Drop an element into a diagram, and the events are: (all return 'true' to EA)
Prefect, and exactly as I expected.

Now change the 'pre diagram object' event to reject this element, so it returns 'false', and we get:
But wait - there's more!
I now get ANOTHER 'EA_OnPreNewElement' event, with the same parameters as before: type & stereotype of the element, and the diagramID.

This is (1) unexpected and (2) a problem.
When the extra event is received, the same code runs as on steps(1) above, and it returns TRUE, which causes an EA error:
'Unknown/illegal base type (UseCase)
Command: UML::UseCase'

(UseCase is just the type i'm using to test this)

..and I can't suppress this message.

I've been trying all day to work out (1) why I get a duplicate event and (2) how to detect that I'm getting a duplicate event, and respond with 'false' the second time around.
So far all solutions are horrible, and are not reliable anyway.

Can anyone suggest why I'm getting the second 'On_Pre_Element' event? Is this a bug? Or a feature ?
Thanks
Ian
Title: Re: EA_OnPreNewElement - duplicate events ?
Post by: qwerty on January 21, 2020, 05:46:44 am
Without checking the details: there have been a couple of "duplicate events" for V15 on spot here. Just queue at the end (my guess).

q.
Title: Re: EA_OnPreNewElement - duplicate events ?
Post by: Ian Mitchell on January 21, 2020, 10:56:26 pm
Update to this:
- responding with 'False' to the duplicate event does NOT fix the problem. It appeared to do, but when I click anywhere in the EA UI, Ea falls over. Which is VERY unusual!
- So, I'm left with always responding with 'True' to the duplicate event, and the user sees the strange EA error message.
Title: Re: EA_OnPreNewElement - duplicate events ?
Post by: Geert Bellekens on January 21, 2020, 11:15:24 pm
Update to this:
- responding with 'False' to the duplicate event does NOT fix the problem. It appeared to do, but when I click anywhere in the EA UI, Ea falls over. Which is VERY unusual!
- So, I'm left with always responding with 'True' to the duplicate event, and the user sees the strange EA error message.
That is not fun :-\

I trust you reported this to Sparx?

Geert
Title: Re: EA_OnPreNewElement - duplicate events ?
Post by: Ian Mitchell on January 22, 2020, 12:06:23 am
...and the point of that would be....
Title: Re: EA_OnPreNewElement - duplicate events ?
Post by: Geert Bellekens on January 22, 2020, 12:55:33 am
...and the point of that would be....
Ian, not you too :o


I still choose to believe that bugs reports like this are being taken seriously by Sparx.
And my recent experience proves that to me.


Geert
Title: Re: EA_OnPreNewElement - duplicate events ?
Post by: Ian Mitchell on January 22, 2020, 02:31:27 am
OK - I''l try...
Title: Re: EA_OnPreNewElement - duplicate events ?
Post by: qwerty on January 22, 2020, 04:17:10 am
Ian, not you too :o


I still choose to believe that bugs reports like this are being taken seriously by Sparx.
And my recent experience proves that to me.


Geert

You either are just more lucky than me. Or the Sparx-God(s) love(s) you more than me (that for sure, anyhow).

q.
Title: Re: EA_OnPreNewElement - duplicate events ?
Post by: Geert Bellekens on January 22, 2020, 06:54:02 pm
You either are just more lucky than me. Or the Sparx-God(s) love(s) you more than me (that for sure, anyhow).
q.

It's not about Sparx-God(s), but about people.

I try to remember that in the end it's actual human beings that read our bug reports and decide what to do with it.
And I am sure that these people, the ones that actually write the code of EA, and the ones doing requirements analyses and stuff. I'm sure that they all want EA to be the best tool it can be.

I try to be respectful of their work and not cynical all of the time. Not only because it might help get my bug reports processed earlier, but also because I don't like to be negative and cynical all the time. It affects my personal well-being.

Sure, there are things that can be done better, and there have been decisions in the past (and probably in the future) that I cannot comprehend, but I refuse to let that drag me down into negativity.

Geert
Title: Re: EA_OnPreNewElement - duplicate events ?
Post by: pvickers on January 23, 2020, 03:40:11 am
Very well said Geert.  I completely agree with your sentiments.

As I post this, I notice Geert currently has 9613 posts on this forum.  Wow.
If we assume an average beer is 385 ml x 9613 helpful posts...as a community we owe Geert 3,701 litres of beer.
(...and this doesn't even begin to address the value of his contributed code/add-ins...)

Have a great and positive day my friend!
 :)

Perry
Title: Re: EA_OnPreNewElement - duplicate events ?
Post by: Geert Bellekens on January 23, 2020, 04:00:55 am
Thanks Perry, you make my day  ;D

I like the idea of measuring one's contribution in liters of beer.

If you really like my open source add-ins and stuff, and you would like to support the development, you can become a sponsor on Github.
Github recently started this sponsorship program where open source contributors can get sponsored by the community.

This is the link to my sponsorship page on Github: https://github.com/sponsors/GeertBellekens (https://github.com/sponsors/GeertBellekens)

Geert
Title: Re: EA_OnPreNewElement - duplicate events ?
Post by: Uffe on January 23, 2020, 06:37:51 pm
You either are just more lucky than me. Or the Sparx-God(s) love(s) you more than me (that for sure, anyhow).
q.

It's not about Sparx-God(s), but about people.

I try to remember that in the end it's actual human beings that read our bug reports and decide what to do with it.
And I am sure that these people, the ones that actually write the code of EA, and the ones doing requirements analyses and stuff. I'm sure that they all want EA to be the best tool it can be.

I try to be respectful of their work and not cynical all of the time. Not only because it might help get my bug reports processed earlier, but also because I don't like to be negative and cynical all the time. It affects my personal well-being.

Sure, there are things that can be done better, and there have been decisions in the past (and probably in the future) that I cannot comprehend, but I refuse to let that drag me down into negativity.

Geert
That's a nice sentiment to be sure, but what goes around comes around and when Sparx' representatives don't take the trouble to keep a civil tone I for one get somewhat less motivated to make excuses for shoddy design and sloppy documentation.

/U
Title: Re: EA_OnPreNewElement - duplicate events ?
Post by: Geert Bellekens on January 23, 2020, 07:00:45 pm
That's a nice sentiment to be sure, but what goes around comes around and when Sparx' representatives don't take the trouble to keep a civil tone I for one get somewhat less motivated to make excuses for shoddy design and sloppy documentation.

/U

I definitely don't think we should make excuses. Please keep pointing out the issues, design flaws etc..
And if something is bad (such as the implementation of the multi-language feature, hidden away in a binary field in t_document so it can't be used anywhere else than in the EA GUI) we should definitely keep pointing that out.

But it's not all bad.
There have been a number of improvements and bugfixes as well.

- Remember the topics about the inconsistencies of the color picking dialogs? In v15.1 I see only one type of color picking dialog
- Diagram placement guidelines
- Full integration with Active Directory Groups
- Diagram Layers

These are all things that we asked for at one point or another.
And these are only the ones that come to mind immediately.

Geert
Title: Re: EA_OnPreNewElement - duplicate events ?
Post by: pvickers on January 24, 2020, 01:50:58 am
Thanks Perry, you make my day  ;D

I like the idea of measuring one's contribution in liters of beer.

If you really like my open source add-ins and stuff, and you would like to support the development, you can become a sponsor on Github.
Github recently started this sponsorship program where open source contributors can get sponsored by the community.

This is the link to my sponsorship page on Github: https://github.com/sponsors/GeertBellekens (https://github.com/sponsors/GeertBellekens)

Geert

Good to know Github is doing this and they currently have a program in place to match the contributions too.

I have sponsored you.

Regards,
Perry
Title: Re: EA_OnPreNewElement - duplicate events ?
Post by: Geert Bellekens on January 24, 2020, 03:48:49 am

Good to know Github is doing this and they currently have a program in place to match the contributions too.

I have sponsored you.

Regards,
Perry
Cool, thanks :)

Geert
Title: Re: EA_OnPreNewElement - duplicate events ?
Post by: Ian Mitchell on January 24, 2020, 08:08:51 pm
@Geert - you, as always, entirely correct:
From Sparx Support:
The issue has been confirmed and will be investigated further by our development team. The reference number for this issue is 20013927. This will be fixed in a future build.

I agree with the general sentiment about cynicism, and avoiding it where possible. We should remember that, compared to absolutely every software product I have used in the last 40 years, EA is by far the most reliable. Those using other modelling tools are in awe of EA's stability under pressure.

Sadly, the fixing of this particular issue doesn't help me at all, as most users will have EA versions which have the error, so my code still needs to handle the duplicate events. But it's one more improvement in product quality.