Book a Demo

Author Topic: Request: EA_OnPreChange events  (Read 6308 times)

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Request: EA_OnPreChange events
« on: January 13, 2012, 03:16:00 am »
Hi!

In an Add-In, to stop the modeller from modelling incorrectly, you can catch EA_OnPreNew and EA_OnPreDelete events.
At the moment, however, there are no EA_OnPreChange events. These are also needed if the Add-In is to have a fighting chance to maintain model integrity.

Looking at the existing EA_OnPre events, I would rank the change events in order of priority thus:
EA_OnPreChangeElement
EA_OnPreChangeConnector
EA_OnPreChangePackage
EA_OnPreChangeAttribute
EA_OnPreChangeMethod
EA_OnPreChangeDiagram
EA_OnPreChangeDiagramObject
EA_OnPreChangeGlossaryTerm

Anyone else?

Cheers,


/Uffe
My theories are always correct, just apply them to the right reality.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Request: EA_OnPreChange events
« Reply #1 on: January 13, 2012, 07:21:24 am »
Why not have a general OnPreChange (element) which passes the according object?

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Request: EA_OnPreChange events
« Reply #2 on: January 13, 2012, 05:09:09 pm »
Isn't that what EA_OnNotifyContextItemModified does?

Geert

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Request: EA_OnPreChange events
« Reply #3 on: January 13, 2012, 07:27:51 pm »
No, OnNotifyContextItemModified corresponds roughly to the OnPostNew events, whereas the OnPreNew and OnPreDelete events are functions returning Booleans, giving the Add-In the ability to block the change by returning False.

Also, I'm pretty sure OnNotifyContextItemModified only informs of items changed through the GUI (the context), not changes done through scripts etc.

A generic OnPreChange() would be a different way of achieving the same thing, but it would be a different design from the existing OnPre and OnPost events. The merits of one over the other can be argued, but konsistency is cey in my book.
My theories are always correct, just apply them to the right reality.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Request: EA_OnPreChange events
« Reply #4 on: January 13, 2012, 10:23:28 pm »
Quote
konsistency is cey
This is in line with the general EA design.

q.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Request: EA_OnPreChange events
« Reply #5 on: January 17, 2012, 02:18:02 pm »
Quote
Quote
konsistency is cey
This is in line with the general EA design.

q.
Careful Uffe, you might be infringing on my trade mark:
Consistency, Consistency, Consistency! TM

 ;)
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Request: EA_OnPreChange events
« Reply #6 on: January 17, 2012, 06:05:25 pm »
Yes - 'cept of course I'd have gone with
        Concistency, konsistency, consistensy!
just because.   :P

Buuuut anyway. Good? Bad? Useless?

/Uffe
My theories are always correct, just apply them to the right reality.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Request: EA_OnPreChange events
« Reply #7 on: January 18, 2012, 05:19:06 am »
Again OT: How is it this thread has an asterisk in the list???

q.
« Last Edit: January 23, 2012, 11:03:43 pm by qwerty »

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Request: EA_OnPreChange events
« Reply #8 on: January 23, 2012, 03:23:27 pm »
Quote
Yes - 'cept of course I'd have gone with
        Concistency, konsistency, consistensy!
just because.   :P

Buuuut anyway. Good? Bad? Useless?

/Uffe
Soo COOL! Uffe!  I'm going to snaffle it - with attribution, of course as in:
Concistency, konsistency, consistensy! TMUffe - after Paolo

Paolo.
« Last Edit: January 23, 2012, 03:27:57 pm by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!