Book a Demo

Author Topic: Customizing shortcut menu in enterprise architect  (Read 6322 times)

sspvirgo

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Customizing shortcut menu in enterprise architect
« 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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Customizing shortcut menu in enterprise archit
« Reply #1 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

sspvirgo

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: Customizing shortcut menu in enterprise archit
« Reply #2 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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Customizing shortcut menu in enterprise archit
« Reply #3 on: July 09, 2011, 01:42:24 am »
Nope, not possible.

Geert

carolin.boeckler

  • EA User
  • **
  • Posts: 34
  • Karma: +0/-0
    • View Profile
Re: Customizing shortcut menu in enterprise archit
« Reply #4 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!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Customizing shortcut menu in enterprise archit
« Reply #5 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

carolin.boeckler

  • EA User
  • **
  • Posts: 34
  • Karma: +0/-0
    • View Profile
Re: Customizing shortcut menu in enterprise archit
« Reply #6 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