專案總管的樹狀項目

Extension 可在開啟中的 RC+ 專案的專案總管中,新增自定義的樹狀項目。
若樹狀項目需與自定義檔案關聯,請使用前述的「專案檔案」擴展點。

樹狀項目可新增多個,且各項目可進行階層化。

樹狀項目的按兩下操作為,

  • 若為父項目,則會展開或摺疊子項目。
  • 若為最末端的子項目,則會呼叫 Extension 的指令。

樹狀項目可擁有內容功能表。選取內容功能表項目時,會呼叫 Extension 的指令。

若要使用此擴展點,請建立並匯出實作介面 IRCXProjectExplorerItemProvide 的類別。

[Export(typeof(IRCXProjectExplorerItemProvider))]
public partial class ProjectExplorerItem : IRCXProjectExplorerItemProvider
{
    /// <inheritdoc />
    public string Id => Main.CommonId;

    /// <inheritdoc />
    public IRCXProjectExplorerItemProvider.Item ProjectExplorerRootItem
    {
        get
        {
            return new()
            {
                Caption = new(Main.CommonId, Caption.PECategory),
                Icon = Main.CommonIcon,
                Children =
                [
                    new()
                    {
                        Caption = new(Main.CommonId, Caption.PEItem),
                        Icon = Main.CommonIcon,
                        CommandName = "ItemCommand",
                        CommandParameter = "ItemCommandParameter",
                        ContextMenuItems =
                        [
                            new()
                            {
                                Caption = new(Main.CommonId, Caption.PEItemMenu),
                                CommandName = "ContextMenuCommand",
                                CommandParameter = "ContextMenuCommandParameter",
                            }
                        ]
                    }
                ]
            };
        }
    }

    /// <inheritdoc />
    public Task ExecuteProjectExplorerItemCommandAsync(
        string commandName,
        object? commandParameter = null
    )
    {
        // (Code here)
        return Task.CompletedTask;
    }
}