[MonoDevelop] Problem extending the project/folder context menu for "Class Wizard"
Chris_hunke at web.de
Sun Dec 28 06:20:22 EST 2008
i want to help MonoDevelop an thought of just trying the sample of new functionality from the Small Tasks "Class Wizard". Just got the source from SVN, compiles fine etc. Now i tried to add my new GtkDialog into the context menu of projects and folders, so i did the following:
Added this to the "MonoDevelop.GtkCore.addin.xml" to define my new command:
<Command id = "MonoDevelop.GtkCore.GtkCommands.AddNewClass"
icon = "md-gtkcore-dialog"
_label = "New Class..." />
Now i added this command to the project and folder add commands:
<Extension path = "/MonoDevelop/Ide/ContextMenu/ProjectPad/Project/Add">
<SeparatorItem insertafter = "MonoDevelop.Ide.Commands.ProjectCommands.AddFiles" />
<CommandItem id = "MonoDevelop.GtkCore.GtkCommands.AddNewClass" />
Of course i added the command also to the enum:
public enum GtkCommands
Then i extended the "UserInterfaceCommandHandler" class inside of "ProjectFolderNodeBuilderExtension.cs" with the following two methods to provide my context menu item functionality:
public void AddNewClassToProject()
DotNetProject project = CurrentNode.GetParentDataItem (typeof(Project), true) as DotNetProject;
if (project == null)
object dataItem = CurrentNode.DataItem;
ProjectFolder folder = CurrentNode.GetParentDataItem (typeof(ProjectFolder), true) as ProjectFolder;
if (folder != null)
path = folder.Path;
path = project.BaseDirectory;
public void UpdateAddNewClassToProject (CommandInfo cinfo)
cinfo.Visible = true;
So I also added the "CreateClass" method that calls my dialog etc. but i think that is not interesting now.
My problem is that my "New Class..." menu item gets displayed correctly and even works fine BUT all other menu items for dialogs are gone and the order seems to be messed up :( Here is an image (sorry its German but I hope you will recognize it):
Can someone help me with that problem, please?
More information about the Monodevelop-list