Check the type of view definition
Use IEditorDef.Type
and IElementDef.Type
to get the type of view definition.
This can be used, for example, to get a specific type of view definition to determine the target for registering a callback function for Conditional formatting changes in Diagram View.
For the type of editor definition (IEditorDef.Type), the following type names can be obtained.
Editor type | Type name |
---|---|
ER Diagram | ERDiagram |
Tree Diagram | TreeDiagram |
Sequence Diagram | SequenceDiagram |
Document Form | DocumentForm |
Tree Grid | TreeGrid |
Custom | Custom |
For the editor element definition type (IElementDef.Type), the following type names can be obtained.
Elements that can be obtained from forms
Editor element type | Type name |
---|---|
Text box | TextBox |
Rich text box | RichTextBox |
CheckBox | CheckBox |
Combo box | ComboBox |
List | List |
Grid | Grid |
Model Reference Control | ModelReferenceControl |
Entity control | EntityControl |
Group control | GroupControl |
Grid column | GridColumn |
Elements that can be obtained from diagrams (ER diagrams, tree diagrams)
Editor element type | Type name |
---|---|
Simple shape | SimpleShape |
Compartment Shape | CompartmentShape |
Port shape | Port |
Connector shape | ConnectorShape |
Elements that can be obtained from tree grids
Editor element type | Type name |
---|---|
List | List |
Entity Control | EntityControl |
Elements that can be obtained from sequence diagrams
Editor element type | Type name |
---|---|
Lifeline | Lifeline |
ExecutionSpecification | ExecutionSpecification |
Fragment | Fragment |
Interaction Use | InteractionUse |
State Invariant | StateInvariant |
Destruction | Destruction |
Message End | MessageEnd |
Note | Note |
Frame | Frame |
Message | Message |
Note Anchor | NoteAnchor |
Currently, it is possible to obtain element definitions other than those listed above, but they are not supported.
An example that displays the editor definitions defined in the profile and the element definitions of those editors.
public void GetDefinitionType(ICommandContext c, ICommandParams p)
{
//Get the profile
IProfile profile = c.App.Workspace.CurrentProject.Profile;
//Get all editor definitions
IEditorDefCollection editorDefs = profile.ViewDefinitions.Editors;
//Print the editor definition and its element definitions
foreach (IEditorDef editorDef in editorDefs)
{
c.App.Output.WriteLine("sample", $"EditorDef: {editorDef.DisplayName}, Type:{editorDef.Type}");
IElementDefCollection elements = editorDef.Elements;
foreach(IElementDef element in elements)
{
c.App.Output.WriteLine("sample", $" ElementDef: {element.DisplayName}, Type:{element.Type}");
}
}
}
The above sample code uses the following APIs, which have been experimentally implemented.
- IEditorDef.DisplayName property
- IElementDef.DisplayName property
These APIs are not guaranteed to be of high quality and are not listed in the API specifications. If you use them, you do so at your own risk.