Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: tzafrir on May 06, 2019, 01:19:44 am

Title: Synchronize stereotype
Post by: tzafrir on May 06, 2019, 01:19:44 am
Hi,

I would like to simulate the action of synchronizing a stereotype from an Addin.
The action in EA is:
Go to toolbox tab -> choose any stereotype -> click Synchronize StereoType.

Is this action feasible threw the EA API?

Tzafrir
Title: Re: Synchronize stereotype
Post by: qwerty on May 06, 2019, 03:29:03 am
You could use Repository.SynchProfile (string Profile, string Stereotype)

unless someone threw it away  ;D

q.
Title: Re: Synchronize stereotype
Post by: Guillaume on May 06, 2019, 04:31:48 pm
You can look at Geert's script here:
https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/blob/master/Framework/Tools/UML%20Profile/Synchronize%20Steretoypes.vbs

It runs Repository.CustomCommand method on a collection of stereotype.
Title: Re: Synchronize stereotype
Post by: qwerty on May 06, 2019, 05:32:28 pm
Actually Repositor.Synchprofile had been opened to overcome the misuse of the undocumented Repository.CustomCommand.

q.
Title: Re: Synchronize stereotype
Post by: tzafrir on May 12, 2019, 07:26:56 pm
thanks for the help
Title: Re: Synchronize stereotype
Post by: Paolo F Cantoni on April 07, 2021, 03:25:34 pm
Actually Repositor.Synchprofile had been opened to overcome the misuse of the undocumented Repository.CustomCommand.

q.
We're about to use this is a serious way.  As we've been playing with tag inheritance and tag prefixes, we've repeatedly found we need to "Synchronize Stereotype".

We're about to programmatically resynchronise various stereotypes (perhaps, on occasion, all in the profile).  Are there any gotchas anyone can provide (or alternatively confirm that "it works as expected")?

TIA,
Paolo

Title: Re: Synchronize stereotype
Post by: Geert Bellekens on April 07, 2021, 03:45:14 pm
From my experience it does exactly the same as the manual synchronize.

Do keep in mind that the read-only status either through locking or version control will not be respected.

Geert
Title: Re: Synchronize stereotype
Post by: Paolo F Cantoni on April 07, 2021, 03:50:47 pm
From my experience, it does exactly the same as manual synchronisation.

Do keep in mind that the read-only status either through locking or version control will not be respected.

Geert
First (potential) Issue...
I used SynchProfile as a function in a VBScript script checking the return result to see if it failed.
Code: [Select]
dim bReturnStatus
bReturnStatus = Repository.SynchProfile("<myProfile>","ZZZZZ<MyStereotype>")
if not bReturnStatus then
Session.Output("Previous SynchProfile - FAILED!!!")
Exit sub
end if
Does SynchProfile return a result?  It seems to return false regardless of whether the Synchronization worked or not.

Paolo