Author Topic: EA_OnPreNewElement - duplicate events ?  (Read 8217 times)

Ian Mitchell

  • EA User
  • **
  • Posts: 506
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
EA_OnPreNewElement - duplicate events ?
« 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)
  • EA_OnPreNewElement (just provides the type of element being added, and the diagram ID.) The real addin does some checking here, and returns TRUE when it's OK. In this test, always responds TRUE
  • EA_OnPostNewElement - now we have the actual element ID
  • EA_OnPreNewDiagramObject - ElementID and diagram ID provided
  • EA_OnPostNewDiagramObject- Element ID and diagram ID again
Prefect, and exactly as I expected.

Now change the 'pre diagram object' event to reject this element, so it returns 'false', and we get:
  • EA_OnPreNewElement (just provides the type of element being added, and the diagram ID
  • EA_OnPostNewElement - now we have the actual element ID
  • EA_OnPreNewDiagramObject - ElementID and diagram ID provided - Return FALSE to reject the element
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
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: EA_OnPreNewElement - duplicate events ?
« Reply #1 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.

Ian Mitchell

  • EA User
  • **
  • Posts: 506
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
Re: EA_OnPreNewElement - duplicate events ?
« Reply #2 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.
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13287
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA_OnPreNewElement - duplicate events ?
« Reply #3 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

Ian Mitchell

  • EA User
  • **
  • Posts: 506
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
Re: EA_OnPreNewElement - duplicate events ?
« Reply #4 on: January 22, 2020, 12:06:23 am »
...and the point of that would be....
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13287
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA_OnPreNewElement - duplicate events ?
« Reply #5 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

Ian Mitchell

  • EA User
  • **
  • Posts: 506
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
Re: EA_OnPreNewElement - duplicate events ?
« Reply #6 on: January 22, 2020, 02:31:27 am »
OK - I''l try...
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: EA_OnPreNewElement - duplicate events ?
« Reply #7 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.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13287
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA_OnPreNewElement - duplicate events ?
« Reply #8 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

pvickers

  • EA User
  • **
  • Posts: 44
  • Karma: +7/-0
    • View Profile
Re: EA_OnPreNewElement - duplicate events ?
« Reply #9 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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13287
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA_OnPreNewElement - duplicate events ?
« Reply #10 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

Geert

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: EA_OnPreNewElement - duplicate events ?
« Reply #11 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
My theories are always correct, just apply them to the right reality.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13287
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA_OnPreNewElement - duplicate events ?
« Reply #12 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

pvickers

  • EA User
  • **
  • Posts: 44
  • Karma: +7/-0
    • View Profile
Re: EA_OnPreNewElement - duplicate events ?
« Reply #13 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

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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13287
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA_OnPreNewElement - duplicate events ?
« Reply #14 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