Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: fginfrance on October 29, 2010, 08:28:38 am
-
Hi,
I am trying to manipulate the default name of the instance of a stereotyped class from a profile.
For that I use the EA_OnPostNewElement() hook to change element.Name.
To avoid the opening of the standard property dialog, I put
rep.SuppressEADialogs = True
as indicated in the help.
Now the problem is that the hook is executed after the property dialog has been shown, so I see the change appearing too late.
Is this an EA bug, do I miss something or is it a problem of my python com client? Anyone could provide a working example in C# to compare?
I add the sample code (python, but straightforward to read):
def EA_OnPostNewElement( self, eaRep, eaInfos ):
msgbox( 'entry' ) # here the property dialog has already been opened & closed
rep = win32com.client.Dispatch( eaRep ) # transforms IDispatch into python object
if rep.SuppressEADialogs:
msgbox( 'Ea2 off' )
else:
msgbox( 'Ea2 on' ) # here MsgBox shows Ea2 on
rep.SuppressEADialogs = True
if rep.SuppressEADialogs:
msgbox( 'Ea3 off' ) # here MsgBox shows Ea3 off, so in principle changing the variable worked
else:
msgbox( 'Ea3 on' )
return True
Thank you in advance,
fginfrance
-
i have exactly the same problem.
it must be a bug because it only occures if the user tries to create a stereotyped element from an own uml Profile.
then the EA Properties Dialogue is opened BEFORE the onPostNewElement() method.
if the user creates a standard non stereotyped uml element from the toolbox the EA Properties Dialogue is opened AFTER the onPostNewElement() so it can be suppressed with suppressEADialogs.
(i use .858)
-
Maybe it's connected to this bug report (https://www.assembla.com/spaces/enterprise-architect/tickets/24-ea_onpre-postnewelement-not-working).
q.
-
it definitely is! thx for you reply
-
So in conclusion, there is hope ;) - as usually is with EA
Thank you qwerty for the reply and the sparx guys for "picking" it up!
fginfrance