Check the editor type
The editor type can be obtained from the EditorType
property of the IEditor
object. The interface in parentheses is derived from IEditor
.
- "DocumentForm" ... Document form (
IForm
) - "TreeGrid" ... Tree grid (
ITreeGrid
) - "ERDiagram" ... ER diagram (
IDiagram
) - "TreeDiagram" ... Tree diagram (
IDiagram
) - "SequenceDiagram" ... Sequence diagram (
ISequenceDiagram
) - "Custom" ... Custom editor (
ICustomEditor
)
public void GetEditor(ICommandContext c, ICommandParams p)
{
IEditor editor = c.App.Workspace.CurrentEditor;
//Output the editor type
c.App.Output.WriteLine("sample", $"EditorType: {editor.EditorType} , ViewDefinitionName: {editor.ViewDefinitionName}" );
//You can also check the IEditor entity interface to determine this.
if ( editor is IDiagram diagram)
{
c.App.Output.WriteLine("sample", "It's a diagram");
}
}