前页 | 后页 |
MDG_Merge
Add-Ins can use MDG_Merge to jointly handle changes to both the model branch and the code project that the model branch is connected to.This event should be called whenever the user has asked to merge their model branch with its connected code project, or whenever the user has established a new connection to a code project.
The purpose of this event is to make the Add-In interact with the user to perform a merge between the model branch and the connected project.
Syntax
Function MDG_Merge (Repository As EA.Repository, PackageGuid As String, SynchObjects As Variant, SynchType As String, ExportObjects As Variant, ExportFiles As Variant, ImportFiles As Variant, IgnoreLocked As String, Language As String) As LongThe MDG_Merge function syntax contains these parameters.
Parameter |
Type |
See also |
---|---|---|
Repository |
EA.Repository Direction: IN Description: An EA.Repository object representing the currently open Enterprise Architect model. Poll its members to retrieve model data and user interface status information. |
Repository Class |
PackageGuid |
String Direction: IN Description: The GUID identifying the Enterprise Architect Package sub-tree that is controlled by the Add-In. |
|
SynchObjects |
Variant Direction: OUT Description: A string array containing a list of objects (Object ID format) to be jointly synchronized between the model branch and the project. See Object ID Format for the format of the Object IDs. |
|
SynchType |
String Direction: OUT Description: The value determining the user-selected type of synchronization to take place. See Synchronize Type for a list of valid values. |
|
ExportObjects |
Variant Direction: OUT Description: The string array containing the list of new model objects (in Object ID format) to be exported by Enterprise Architect to the code project. |
|
ExportFiles |
Variant Direction: OUT Description: A string array containing the list of files for each model object chosen for export by the Add-In. Each entry in this array must have a corresponding entry in the ExportObjects parameter at the same array index, so ExportFiles(2) must contain the filename of the object by ExportObjects(2). |
|
ImportFiles |
Variant Direction: OUT Description: A string array containing the list of code files made available to the code project to be newly imported to the model. Enterprise Architect imports each file listed in this array for import into the connected model branch. |
|
IgnoreLocked |
String Direction: OUT Description: A value indicating whether to ignore any files locked by the code project (that is, 'True' or False'). |
|
Language |
String Direction: OUT Description: The string value containing the name of the code language supported by the code project connected to the model branch. |
Object ID Format
Each of the Object IDs listed in the 'SynchObjects' string arrays should have this format:(@namespace)*(#class)*($attribute|%operation|:property)*
Return Value
- Return a non-zero if the merge operation completed successfully
- Return a zero when the operation has been unsuccessful
Merge
A merge consists of three major operations:- Export: where newly created model objects are exported into code and made available to the code project
- Import: where newly created code objects, Classes and such things are imported into the model
- Synchronize: where objects available both to the model and in code are jointly updated to reflect changes made in either the model, code project or both
Synchronize Type
The Synchronize operation can take place in one of four different ways. Each of these ways corresponds to a value returned by 'SynchType':- None: (SynchType' = 0) No synchronization is to be performed
- Forward: ('SynchType' = 1) Forward synchronization, between the model branch and the code project is to occur
- Reverse: ('SynchType = 2) Reverse synchronization, between the code project and the model branch is to occur
- Both: ('SynchType' = 3) Reverse, then Forward synchronizations are to occur