Skip to main content

Get editors from the model

To get editors from the model, use the GetEditors method of the IModel object.

public void GetEditors(ICommandContext c, ICommandParams p) 
{
IModel model = c.App.Workspace.CurrentModel;

//Get a list of editors
var editors = model.GetEditors();

if (editors.Count() == 0)
{
c.App.Output.WriteLine("sample", "No editors.");
return;
}
else
{
int count = 1;
foreach (var editor in editors) {

//Output editor information
c.App.Output.WriteLine("sample", $"{count}th definition name: {editor.ViewDefinitionName}/type: {editor.EditorType}");
count++;
}
}
}