public ToolStripItem[] BuildSubmenu(Codon codon, object owner)
        {
            MenuCommand cmd;
            IMember     member;
            MemberNode  memberNode = owner as MemberNode;

            if (memberNode != null)
            {
                member = memberNode.Member;
            }
            else
            {
                ClassMemberBookmark bookmark = (ClassMemberBookmark)owner;
                member = bookmark.Member;
            }
            IMethod method            = member as IMethod;
            List <ToolStripItem> list = new List <ToolStripItem>();

            bool canGenerateCode =
                member.DeclaringType.ProjectContent.Language.CodeGenerator != null &&
                !FindReferencesAndRenameHelper.IsReadOnly(member.DeclaringType);

            if (method == null || !method.IsConstructor)
            {
                if (!FindReferencesAndRenameHelper.IsReadOnly(member.DeclaringType) &&
                    !(member is IProperty && ((IProperty)member).IsIndexer))
                {
                    cmd     = new MenuCommand("${res:SharpDevelop.Refactoring.RenameCommand}", Rename);
                    cmd.Tag = member;
                    list.Add(cmd);
                }
            }
            if (member.IsOverride)
            {
                cmd     = new MenuCommand("${res:SharpDevelop.Refactoring.GoToBaseClassCommand}", GoToBase);
                cmd.Tag = member;
                list.Add(cmd);
            }
            if (member.IsVirtual || member.IsAbstract || (member.IsOverride && !member.DeclaringType.IsSealed))
            {
                cmd     = new MenuCommand("${res:SharpDevelop.Refactoring.FindOverridesCommand}", FindOverrides);
                cmd.Tag = member;
                list.Add(cmd);
            }

            cmd     = new MenuCommand("${res:SharpDevelop.Refactoring.FindReferencesCommand}", FindReferences);
            cmd.Tag = member;
            list.Add(cmd);

            if (member is IField && member.DeclaringType.ClassType != ClassType.Enum)
            {
                IProperty foundProperty = FindReferencesAndRenameHelper.FindProperty(member as IField);
                if (foundProperty != null)
                {
                    cmd     = new MenuCommand("${res:SharpDevelop.Refactoring.GoToProperty}", GotoTagMember);
                    cmd.Tag = foundProperty;
                    list.Add(cmd);
                }
                else
                {
                    if (canGenerateCode)
                    {
                        if (member.IsReadonly)
                        {
                            cmd     = new MenuCommand("${res:SharpDevelop.Refactoring.CreateProperty}", CreateGetter);
                            cmd.Tag = member;
                            list.Add(cmd);
                        }
                        else
                        {
                            cmd     = new MenuCommand("${res:SharpDevelop.Refactoring.CreateGetter}", CreateGetter);
                            cmd.Tag = member;
                            list.Add(cmd);
                            cmd     = new MenuCommand("${res:SharpDevelop.Refactoring.CreateProperty}", CreateProperty);
                            cmd.Tag = member;
                            list.Add(cmd);
                        }
                    }
                }
            }
            if (member is IProperty)
            {
                if (((IProperty)member).CanSet && canGenerateCode)
                {
                    cmd     = new MenuCommand("${res:SharpDevelop.Refactoring.CreateChangedEvent}", CreateChangedEvent);
                    cmd.Tag = member;
                    list.Add(cmd);
                }
            }
            if (member is IEvent)
            {
                if (canGenerateCode)
                {
                    cmd     = new MenuCommand("${res:SharpDevelop.Refactoring.CreateOnEventMethod}", CreateOnEventMethod);
                    cmd.Tag = member;
                    list.Add(cmd);
                }
            }

            return(list.ToArray());
        }