エディタの種類を調べる
エディタの種類はIEditorオブジェクトのEditorTypeプロパティで取得できます。括弧内はIEditorの派生インタフェースです。
- "DocumentForm" ... ドキュメントフォーム (
IForm) - "TreeGrid" ... ツリーグリッド (
ITreeGrid) - "ERDiagram" ... ERダイアグラム (
IDiagram) - "TreeDiagram" ... ツリーダイアグラム (
IDiagram) - "SequenceDiagram" ... シーケンスダイアグラム (
ISequenceDiagram) - "Custom" ... カスタムエディタ (
ICustomEditor)
public void GetEditor(ICommandContext c, ICommandParams p)
{
IEditor editor = c.App.Workspace.CurrentEditor;
// エディタの種類を出力します
c.App.Output.WriteLine("sample", $"EditorType: {editor.EditorType} , ViewDefinitionName: {editor.ViewDefinitionName}" );
// IEditorの実体のインタフェースを調べる事で判断も可能です
if ( editor is IDiagram diagram)
{
c.App.Output.WriteLine("sample", "ダイアグラムです");
}
}