Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: sspvirgo on July 08, 2011, 12:01:20 am

Title: Customizing shortcut menu in enterprise architect
Post by: sspvirgo on July 08, 2011, 12:01:20 am
Hi,

As such when we do add-ins it display that as under Add-ins option on right click if we directly want the user to show the menu option which we created on right click what needs to be done

Is there a way to do it i am new to it and dont know how to go about it.

Appreciate your help on this.

Thanks
Title: Re: Customizing shortcut menu in enterprise archit
Post by: Geert Bellekens on July 08, 2011, 04:42:16 pm
Hi,

I'm not sure if I understood your question correctly, but If you're asking if you can add a menu option to another menu then the add-in menu, then the answer is no.

Geert
Title: Re: Customizing shortcut menu in enterprise archit
Post by: sspvirgo on July 08, 2011, 11:10:33 pm
Thanks Greet my question was the one you understood. But when you right click the menu option we created it comes under Add-ins-> Menu -> Submenu is it possible that when we right click it directly shows the menu option with out being the submenu of the add-ins.

Thanks
Title: Re: Customizing shortcut menu in enterprise archit
Post by: Geert Bellekens on July 09, 2011, 01:42:24 am
Nope, not possible.

Geert
Title: Re: Customizing shortcut menu in enterprise archit
Post by: carolin.boeckler on January 11, 2012, 07:47:01 pm
Yep, it is possible.
The solution is: Change the source!

In EAAddinBase.cs insert parts where Author is: Dr. Carolin Böckler. It is just a part of the source!!

public abstract class EAAddinBase
{
  
        private string _menuHeader = string.Empty;
        private string[] _menuOptions = {string.Empty};

        //Author: Dr. Carolin Böckler
        private string _submenuHeader = string.Empty;
        private string[] _submenuOptions = { string.Empty };  
                     
              protected virtual string menuHeader {
                 get { return _menuHeader; }
                 set { _menuHeader = value; }
        }

        //Author: Dr. Carolin Böckler
        protected virtual string submenuHeader
        {
            get { return _submenuHeader; }
            set { _submenuHeader = value; }
        }

               protected virtual string[] menuOptions{
              get { return _menuOptions; }
              set { _menuOptions = value; }
        }

        //Author: Dr. Carolin Böckler
        protected virtual string[] submenuOptions
        {
            get { return _submenuOptions; }
            set { _submenuOptions = value; }
        }

.....
}


public virtual object EA_GetMenuItems(EA.Repository Repository, string MenuLocation, string MenuName)
{
              if (MenuName == string.Empty) {
                    //return top level menu option
                    return this.menuHeader;
            }
            else if (MenuName == this.menuHeader)
            {
                // return submenu options
                return this.menuOptions;
            } //Author: Dr. Carolin Böckler
            else if (MenuName == this.submenuHeader) {
                    // return submenu options
                    return this.submenuOptions;
              }
            else
            {
                    return string.Empty;
              }
            
}

And in your mainClass.cs
 ....
        public mainClass()
            : base()
        {          
            this.menuHeader = MenuName;
            
            this.menuOptions = new string[]{ MenuLineAutomation,      MenuSettings, MenuHelp };
           //Author: Dr. Carolin Böckler
            this.submenuHeader = MenuWois;
            this.submenuOptions = new string[] { MenuWoisSocial, MenuWoisTech };
                      
        }

I hope it will help you!
Title: Re: Customizing shortcut menu in enterprise archit
Post by: Geert Bellekens on January 11, 2012, 08:12:39 pm
Caroline,

Of course you can change the menu options, but they will still  only appear under the "Add-Ins" (pre 9.2) or "Extensions" (post 9.2) menu option not?
I thought the question was to be able to add a menu options in say "File" or "Diagram" something like that.

Geert
Title: Re: Customizing shortcut menu in enterprise archit
Post by: carolin.boeckler on January 11, 2012, 10:35:16 pm
Hallo Geert,

I just was reading the part in bold, cause I was looking for such an answer. My fault...

"Thanks Greet my question was the one you understood. But when you right click the menu option we created it comes under Add-ins-> Menu -> Submenu is it possible that when we right click it directly shows the menu option with out being the submenu of the add-ins."

Couse this was my question, some time ago.

But maybe it will help somebody else.

Thanks for your comment.

Bye, Caro