Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Tehila1 on August 10, 2014, 09:28:11 pm

Title: Addins sub-menus
Post by: Tehila1 on August 10, 2014, 09:28:11 pm
Hello,

I would like to create third-level sub-menus to the addin menu.
The following code creates one menu under Extensions, and under it, one level of sub-menus.

Code: [Select]
//Addin menu
private const string mainAddinMenuName = "-&Addin menu name";

//The sub-menus
private const string SVNConfigurationMenu = "&sub-menu 1";
private const string SVNClearDataMenu = "&sub-menu 2";

//Initialize the addins menus in the right order
this.menuHeader = mainAddinMenuName;
this.menuOptions = new string[] { sub-menu 1, sub-menu 2};

Is it possible to add more sub-menus under the existing ones?
Title: Re: Addins sub-menus
Post by: ZuluTen on August 10, 2014, 10:28:11 pm
Yes, I've got three 'layers' of menus, and different ones for Diagram, Menu and Tree.
If you look at the EA_GetMenuItems instruction in the Manual you'll see an example.
The following is Sparx' own construct which you'll see puts Menus 5 and 6 in layer 3:
Code: [Select]
   Public Function EA_GetMenuItems(ByVal Repository As EA.Repository, ByVal Location As String, ByVal MenuName As String) As Object
        Select Case MenuName
            Case ""
                EA_GetMenuItems = "-&VBNet Addin Framework"
                Exit Function
            Case "-&VBNet Addin Framework"
                EA_GetMenuItems = New String() {"Menu1", "Menu2", "Menu3", "-Menu4", "-", "Show Output", "About..."}
                Exit Function
            Case "-Menu4"
                EA_GetMenuItems = New String() {"Menu5", "Menu6"}
                Exit Function
        End Select
        EA_GetMenuItems = ""
    End Function