MDG_PostGenerate

Topics

Topic

Detail

See also

Details

MDG_PostGenerate enables the Add-In to handle file changes caused by generation.

This event is called after Enterprise Architect has prepared text to replace the existing contents of a file. Responding to this event enables the Add-In to write to the linked application's user interface rather than modify the file directly.

When the contents of a file are changed, Enterprise Architect passes FileContents as a non-empty string. New files created as a result of code generation are also sent through this mechanism, enabling Add-Ins to add new files to the linked project's file list.

When new files are created Enterprise Architect passes FileContents as an empty string. When a non-zero is returned by this function, the Add-In has successfully written the contents of the file. A zero value for the return indicates to Enterprise Architect that the file must be saved.

 

MDG_PreGenerate

Syntax:

Function MDG_PostGenerate(Repository As EA.Repository, PackageGuid As String, FilePath As String, FileContents As String) As Long

The MDG_PostGenerate function syntax contains the following elements:

Parameter

Type

Direction

Description

FileContents

String

IN

A string containing the proposed contents of the file.

 

FilePath

String

IN

The path of the file Enterprise Architect intends to overwrite.

 

PackageGuid

String

IN

The GUID identifying the Enterprise Architect Package sub-tree that is controlled by the Add-In.

 

Repository

EA.Repository

IN

An EA.Repository object representing the currently open Enterprise Architect model.

Poll its members to retrieve model data and user interface status information.

 

Return Value:

The return value depends on the type of event that this function is responding to (see Details, above). This function is required to handle two separate and distinct cases.