Skip to main content

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 typeType name
ER DiagramERDiagram
Tree DiagramTreeDiagram
Sequence DiagramSequenceDiagram
Document FormDocumentForm
Tree GridTreeGrid
CustomCustom

For the editor element definition type (IElementDef.Type), the following type names can be obtained.

Elements that can be obtained from forms

Editor element typeType name
Text boxTextBox
Rich text boxRichTextBox
CheckBoxCheckBox
Combo boxComboBox
ListList
GridGrid
Model Reference ControlModelReferenceControl
Entity controlEntityControl
Group controlGroupControl
Grid columnGridColumn

Elements that can be obtained from diagrams (ER diagrams, tree diagrams)

Editor element typeType name
Simple shapeSimpleShape
Compartment ShapeCompartmentShape
Port shapePort
Connector shapeConnectorShape

Elements that can be obtained from tree grids

Editor element typeType name
ListList
Entity ControlEntityControl

Elements that can be obtained from sequence diagrams

Editor element typeType name
LifelineLifeline
ExecutionSpecificationExecutionSpecification
FragmentFragment
Interaction UseInteractionUse
State InvariantStateInvariant
DestructionDestruction
Message EndMessageEnd
NoteNote
FrameFrame
MessageMessage
Note AnchorNoteAnchor
Note

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}");
}
}
}
info

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.