Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started 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
-
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
-
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
-
Nope, not possible.
Geert
-
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!
-
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
-
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