/// <summary>
        /// Gets the main menu
        /// </summary>
        /// <param name="workbench"></param>
        /// <returns></returns>
        public MenuStrip GetMainMenu(WorkbenchBase workbench)
        {
            var menu = new System.Windows.Forms.MenuStrip();

            MenuService.AddItemsToMenu(menu.Items, workbench, "/Maestro/Shell/MainMenu"); //NOXLATE
            return(menu);
        }
示例#2
0
        ToolStripMenuItem MakeItem(string title, ExtTreeNode classBrowserTreeNode, ICompilationUnit cu, DomRegion region)
        {
            ToolStripMenuItem item = MakeItemInternal(classBrowserTreeNode.Text, classBrowserTreeNode.ImageIndex, cu, region);

            MenuService.AddItemsToMenu(item.DropDown.Items, classBrowserTreeNode, classBrowserTreeNode.ContextmenuAddinTreePath);
            return(item);
        }
示例#3
0
 void CreateMainMenu()
 {
     TopMenu = new MenuStrip();
     TopMenu.Items.Clear();
     try {
         MenuService.AddItemsToMenu(TopMenu.Items, this, mainMenuPath);
         UpdateMenus();
     } catch (TreePathNotFoundException) {}
 }
示例#4
0
        private Workbench()
        {
            InitializeComponent();

            _toolstrips       = new Dictionary <string, ToolStrip>();
            _toolstripRegions = new Dictionary <string, ToolbarRegion>();

            this.Icon = ResourceService.GetIcon("FdoToolbox");

            contentPanel = new DockPanel();
            contentPanel.DocumentStyle     = DocumentStyle.DockingWindow;
            contentPanel.Dock              = DockStyle.Fill;
            contentPanel.DockLeftPortion   = 200;
            contentPanel.DockBottomPortion = 150;
            contentPanel.DockRightPortion  = 200;

            menu = new MenuStrip();
            MenuService.AddItemsToMenu(menu.Items, this, "/Workbench/MainMenu");

            toolStripContainer = new ToolStripContainer();
            toolStripContainer.ContentPanel.Controls.Add(contentPanel);
            toolStripContainer.Dock = DockStyle.Fill;

            this.Controls.Add(toolStripContainer);

            ctxToolbar = new ContextMenuStrip();
            toolStripContainer.TopToolStripPanel.ContextMenuStrip    = ctxToolbar;
            toolStripContainer.BottomToolStripPanel.ContextMenuStrip = ctxToolbar;
            toolStripContainer.LeftToolStripPanel.ContextMenuStrip   = ctxToolbar;
            toolStripContainer.RightToolStripPanel.ContextMenuStrip  = ctxToolbar;

            toolbar = ToolbarService.CreateToolStrip(this, "/Workbench/Toolbar");
            AddToolbar("Base", toolbar, ToolbarRegion.Top, false);

            status      = new StatusStrip();
            statusLabel = new ToolStripStatusLabel();
            status.Items.Add(statusLabel);

            this.Controls.Add(menu);
            this.Controls.Add(status);

            //this.IsMdiContainer = true;

            ObjectExplorer exp = new ObjectExplorer();

            objExplorer = exp;

            ConsolePane console = new ConsolePane();

            appConsole = console;

            ShowContent(console, ViewRegion.Bottom);
            ShowContent(exp, ViewRegion.Left);

            // Use the Idle event to update the status of menu and toolbar items.
            Application.Idle += OnApplicationIdle;
        }
示例#5
0
 void CreateMainMenu()
 {
     TopMenu      = new MenuStrip();
     TopMenu.Font = new Font(TopMenu.Font.FontFamily, MENU_FONT_SIZE);
     TopMenu.Items.Clear();
     try
     {
         MenuService.AddItemsToMenu(TopMenu.Items, this, mainMenuPath);
         UpdateMenus();
     }
     catch (TreePathNotFoundException) { }
 }
示例#6
0
        ToolStripMenuItem MakeItem(LocalResolveResult local, bool isDefinition)
        {
            ToolStripMenuItem item = MakeItemInternal(MemberNode.GetText(local.Field),
                                                      local.IsParameter ? ClassBrowserIconService.ParameterIndex : ClassBrowserIconService.LocalVariableIndex,
                                                      local.CallingClass.CompilationUnit,
                                                      isDefinition ? DomRegion.Empty : local.Field.Region);
            string treePath = "/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/";

            treePath += local.IsParameter ? "Parameter" : "LocalVariable";
            if (isDefinition)
            {
                treePath += "Definition";
            }
            MenuService.AddItemsToMenu(item.DropDown.Items, local, treePath);
            return(item);
        }
示例#7
0
        ToolStripMenuItem MakeItem(LocalResolveResult local, RefactoringMenuContext context)
        {
            Debug.Assert(local == context.ResolveResult);
            ToolStripMenuItem item = MakeItemInternal(local.VariableName,
                                                      local.IsParameter ? ClassBrowserIconService.ParameterIndex : ClassBrowserIconService.LocalVariableIndex,
                                                      local.CallingClass.CompilationUnit,
                                                      context.IsDefinition ? DomRegion.Empty : local.VariableDefinitionRegion);
            string treePath = "/SharpDevelop/ViewContent/DefaultTextEditor/Refactoring/";

            treePath += local.IsParameter ? "Parameter" : "LocalVariable";
            if (context.IsDefinition)
            {
                treePath += "Definition";
            }
            MenuService.AddItemsToMenu(item.DropDown.Items, context, treePath);
            return(item);
        }
示例#8
0
 void CreateMainMenu()
 {
     TopMenu = new MenuStrip();
     TopMenu.Items.Clear();
     try
     {
         MenuService.AddItemsToMenu(TopMenu.Items, this, mainMenuPath);
         //ToolStripItem[] items = (ToolStripItem[])(AddInTree.GetTreeNode(mainMenuPath).BuildChildItems(this)).ToArray(typeof(ToolStripItem));
         //TopMenu.Items.AddRange(items);
         //if (_ViewItem != null)
         //{
         //    ToolStripMenuItem pad = new ToolStripMenuItem("&Pad");
         //    pad.DropDownItems.AddRange(_ViewItem);
         //    TopMenu.Items.Add(pad);
         //}
         UpdateMenus();
     }
     catch (TreePathNotFoundException) { }
 }
示例#9
0
        private void InitializeAddInSupport()
        {
            _addInToolStrip = ToolbarService.CreateToolStrip(this, "/Workspace/TextEditor/Toolbar");
            if (_addInToolStrip.Items.Count == 0)
            {
                _addInToolStrip.Visible = false;
            }
            else
            {
                _addInToolStrip.Visible = true;
                this.Controls.Add(_addInToolStrip);
                _addInToolStrip.RenderMode = ToolStripRenderMode.ManagerRenderMode;
                _addInToolStrip.GripStyle  = ToolStripGripStyle.Hidden;
                _addInToolStrip.Dock       = DockStyle.Top;
                _addInToolStrip.BringToFront();
                panEditor.BringToFront();
            }

            MenuService.AddItemsToMenu(popUpEditor.Items, this, "/Workspace/TextEditor/ContextMenu");
            MenuService.AddItemsToMenu(mainMenu.Items, this, "/Workspace/TextEditor/MainMenu");
            MenuService.AddItemsToMenu(popUpTab.Items, this, "/Workspace/TextEditor/ContentContextMenu");
        }
示例#10
0
        private Workbench()
        {
            // restore form location from last session
            FormLocationHelper.Apply(this, "StartupFormPosition", true);

            contentPanel      = new Panel();
            contentPanel.Dock = DockStyle.Fill;
            this.Controls.Add(contentPanel);

            menu = new MenuStrip();
            MenuService.AddItemsToMenu(menu.Items, this, "/Workbench/MainMenu");

            toolbar = ToolbarService.CreateToolStrip(this, "/Workbench/Toolbar");

            this.Controls.Add(toolbar);
            this.Controls.Add(menu);

            // Start with an empty text file
            ShowContent(new TextViewContent());

            // Use the Idle event to update the status of menu and toolbar items.
            Application.Idle += OnApplicationIdle;
        }
 protected override void OnOwnerChanged(EventArgs e)
 {
     base.OnOwnerChanged(e);
     dropDownButton = (ToolBarDropDownButton)Owner;
     MenuService.AddItemsToMenu(dropDownButton.DropDownItems, this, "/SharpDevelop/Pads/ClassBrowser/Toolbar/SelectFilter");
 }
示例#12
0
        public ToolStripItem[] BuildSubmenu(Codon codon, object owner)
        {
            ToolStripMenuItem item;

            TextEditorControl textEditorControl = (TextEditorControl)owner;

            if (textEditorControl.FileName == null)
            {
                return(new ToolStripItem[0]);
            }
            List <ToolStripItem> resultItems = new List <ToolStripItem>();
            TextArea             textArea    = textEditorControl.ActiveTextAreaControl.TextArea;
            IDocument            doc         = textArea.Document;
            int caretLine = textArea.Caret.Line;

            // list of dotnet names that have definition bookmarks in this line
            List <string> definitions = new List <string>();

            // Include definitions (use the bookmarks which should already be present)
            foreach (Bookmark mark in doc.BookmarkManager.Marks)
            {
                if (mark != null && mark.LineNumber == caretLine)
                {
                    ClassMemberBookmark cmb = mark as ClassMemberBookmark;
                    ClassBookmark       cb  = mark as ClassBookmark;
                    IClass type             = null;
                    if (cmb != null)
                    {
                        definitions.Add(cmb.Member.DotNetName);
                        item = new ToolStripMenuItem(MemberNode.GetText(cmb.Member),
                                                     ClassBrowserIconService.ImageList.Images[cmb.IconIndex]);
                        MenuService.AddItemsToMenu(item.DropDown.Items, mark, ClassMemberBookmark.ContextMenuPath);
                        resultItems.Add(item);
                        type = cmb.Member.DeclaringType;
                    }
                    else if (cb != null)
                    {
                        type = cb.Class;
                    }
                    if (type != null)
                    {
                        definitions.Add(type.DotNetName);
                        item = new ToolStripMenuItem(type.Name, ClassBrowserIconService.ImageList.Images[ClassBrowserIconService.GetIcon(type)]);
                        MenuService.AddItemsToMenu(item.DropDown.Items,
                                                   cb ?? new ClassBookmark(textArea.Document, type),
                                                   ClassBookmark.ContextMenuPath);
                        resultItems.Add(item);
                    }
                }
            }

            // Include menu for member that has been clicked on
            IExpressionFinder expressionFinder = ParserService.GetExpressionFinder(textEditorControl.FileName);
            ExpressionResult  expressionResult;
            ResolveResult     rr;
            int insertIndex = resultItems.Count;                // Insert items at this position to get the outermost expression first, followed by the inner expressions (if any).

            expressionResult = FindFullExpressionAtCaret(textArea, expressionFinder);
repeatResolve:
            rr   = ResolveExpressionAtCaret(textArea, expressionResult);
            item = null;
            if (rr is MethodResolveResult)
            {
                item = MakeItem(definitions, ((MethodResolveResult)rr).GetMethodIfSingleOverload());
            }
            else if (rr is MemberResolveResult)
            {
                MemberResolveResult mrr = (MemberResolveResult)rr;
                item = MakeItem(definitions, mrr.ResolvedMember);
                if (RefactoringService.FixIndexerExpression(expressionFinder, ref expressionResult, mrr))
                {
                    if (item != null)
                    {
                        resultItems.Insert(insertIndex, item);
                    }
                    // Include menu for the underlying expression of the
                    // indexer expression as well.
                    goto repeatResolve;
                }
            }
            else if (rr is TypeResolveResult)
            {
                item = MakeItem(definitions, ((TypeResolveResult)rr).ResolvedClass);
            }
            else if (rr is LocalResolveResult)
            {
                item        = MakeItem((LocalResolveResult)rr, caretLine + 1 == ((LocalResolveResult)rr).Field.Region.BeginLine);
                insertIndex = 0;                        // Insert local variable menu item at the topmost position.
            }
            if (item != null)
            {
                resultItems.Insert(insertIndex, item);
            }

            // Include menu for current class and method
            IMember callingMember = null;

            if (rr != null)
            {
                callingMember = rr.CallingMember;
            }
            else
            {
                ParseInformation parseInfo = ParserService.GetParseInformation(textEditorControl.FileName);
                if (parseInfo != null)
                {
                    ICompilationUnit cu = parseInfo.MostRecentCompilationUnit;
                    if (cu != null)
                    {
                        IClass callingClass = cu.GetInnermostClass(caretLine + 1, textArea.Caret.Column + 1);
                        callingMember = GetCallingMember(callingClass, caretLine + 1, textArea.Caret.Column + 1);
                    }
                }
            }
            if (callingMember != null)
            {
                item = MakeItem(definitions, callingMember);
                if (item != null)
                {
                    item.Text = StringParser.Parse("${res:SharpDevelop.Refactoring.CurrentMethod}: ") + callingMember.Name;
                    resultItems.Add(item);
                }
            }

            if (resultItems.Count == 0)
            {
                return(new ToolStripItem[0]);
            }
            else
            {
                resultItems.Add(new MenuSeparator());
                return(resultItems.ToArray());
            }
        }
 protected override void OnOwnerChanged(EventArgs e)
 {
     base.OnOwnerChanged(e);
     dropDownButton = (ToolBarDropDownButton)Owner;
     MenuService.AddItemsToMenu(dropDownButton.DropDownItems, this, "/SharpDevelop/Pads/CodeCoveragePad/Toolbar/CodeCoveragePadDisplayOptions");
 }
        public ContextMenuStrip CreateNodeContextMenu(int objectType)
        {
            if (_contextMenus.Keys.Contains(objectType))
            {
                return(_contextMenus[objectType]);
            }

            ToolStripMenuItem item = null;
            ContextMenuStrip  mnu  = null;

            mnu          = new ContextMenuStrip(this.components);
            mnu.Opening += new System.ComponentModel.CancelEventHandler(mnu_Opening);
            switch (objectType)
            {
            case DBObjectType.Server:
                mnu.Items.Add("Connect To", null, OnNewConnectionClick);
                mnu.Items.Add("Connection From List", null, OnNewConnectionFromRepositoryClick);
                mnu.Items.Add("Disconnect From Server", null, OnDisconnectClick);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("New Script", null, OnCreateScriptEditorClick);
                mnu.Items.Add("Refresh", null, OnRefreshNodeClick);
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu/Server");
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu");
                break;

            case DBObjectType.UsersGroup:
                //mnu.Items.Add("View As List", null, null);
                mnu.Items.Add("Filter", null, OnFilterClick);
                mnu.Items.Add("Clear Filter", null, OnClearFilterClick);
                //mnu.Items.Add("-", null, null);
                mnu.Items.Add("Refresh", null, OnRefreshNodeClick);
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu/UsersGroup");
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu");
                break;

            case DBObjectType.Database:
                mnu.Items.Add("New Script", null, OnCreateScriptEditorClick);

                //mnu.Items.Add("Script Objects", null, OnScriptDatabaseObjects);
                //mnu.Items.Add("Bulk Copy Data", null, OnBulkCopyData);

                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Search on Db", null, OnCreateDatabaseSearchForm);
                mnu.Items.Add("Chanage History", null, OnShowObjectChangeHistoryViewer);
                mnu.Items.Add("Object Grouping", null, OnCreateObjectGroupingForm);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Refresh", null, OnRefreshNodeClick);
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu/Database");
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu");
                break;

            case DBObjectType.GroupingFolderB:
                //mnu.Items.Add("View As List", null, null);
                mnu.Items.Add("Filter", null, OnFilterClick);
                mnu.Items.Add("Clear Filter", null, OnClearFilterClick);
                mnu.Items.Add("New Script", null, OnCreateScriptEditorClick);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Search on Db", null, OnCreateDatabaseSearchForm);
                mnu.Items.Add("Chanage History", null, OnShowObjectChangeHistoryViewer);
                mnu.Items.Add("Object Grouping", null, OnCreateObjectGroupingForm);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Refresh", null, OnRefreshNodeClick);
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu/Folder");
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu");
                break;

            case DBObjectType.GroupingFolderY:
                //mnu.Items.Add("View As List", null, null);
                mnu.Items.Add("Filter", null, OnFilterClick);
                mnu.Items.Add("Clear Filter", null, OnClearFilterClick);
                mnu.Items.Add("New Script", null, OnCreateScriptEditorClick);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Search on Db", null, OnCreateDatabaseSearchForm);
                mnu.Items.Add("Chanage History", null, OnShowObjectChangeHistoryViewer);
                mnu.Items.Add("Object Grouping", null, OnCreateObjectGroupingForm);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Refresh", null, OnRefreshNodeClick);
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu/Folder");
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu");
                break;

            case DBObjectType.Column:
                mnu.Items.Add("Permissions", null, OnHelpColumnPermissionClick);
                mnu.Items.Add("New Script", null, OnCreateScriptEditorClick);
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu/Column");
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu");
                break;

            case DBObjectType.UserTable:
                mnu.Items.Add("Select Top 100 Rows", null, OnSelectTop100RowsClick);
                mnu.Items.Add("Open", null, OnOpenTableDataEditorClick);

                mnu.Items.Add("Drop", null, OnDropObject);
                mnu.Items.Add("View Columns", null, OnViewColumnsClick);
                mnu.Items.Add("View References", null, OnAnyReferenceClick);

                mnu.Items.Add("-", null, null);

                item = (ToolStripMenuItem)mnu.Items.Add("Generate", null, null);
                item.DropDownItems.Add("Drop Script", null, OnGenerateDropScript);
                //item.DropDownItems.Add("Create", null, OnGenerateCreateScript);
                item.DropDownItems.Add("CRUD Procedures", null, OnGenerateCrudProcedures);

                item = (ToolStripMenuItem)mnu.Items.Add("Table Info", null, null);
                item.DropDownItems.Add("Table Permissions", null, OnHelpPermissionClick);
                item.DropDownItems.Add("Column Permissions", null, OnHelpTableColumnPermissionClick);
                item.DropDownItems.Add("Foreign Keys", null, OnHelpForeignKeysClick);
                item.DropDownItems.Add("Foreign Key In", null, OnHelpForeignKeyInClick);
                item.DropDownItems.Add("Constraints", null, OnHelpConstraintsClick);
                item.DropDownItems.Add("Special Columns", null, OnHelpSpecialColumnsClick);
                item.DropDownItems.Add("-", null, null);
                item.DropDownItems.Add("Used Space", null, OnHelpUsedSpaceClick);
                item.DropDownItems.Add("Statistics", null, OnHelpStatisticsClick);

                mnu.Items.Add("Object Help", null, OnObjectHelpClick);
                mnu.Items.Add("Dependencies", null, OnHelpDependsClick);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Add Object To Group", null, OnAddSerlectedObjectsToGroup);
                mnu.Items.Add("Show Grouping Statistics", null, OnShowObjectGroupingStatistics);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("New Script", null, OnCreateScriptEditorClick);
                mnu.Items.Add("Refresh", null, OnRefreshNodeClick);

                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu/UserTable");
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu");
                break;

            case DBObjectType.SystemTable:
                mnu.Items.Add("Select Top 100 Rows", null, OnSelectTop100RowsClick);
                mnu.Items.Add("Open", null, OnOpenTableDataEditorClick);
                mnu.Items.Add("View Columns", null, OnViewColumnsClick);
                mnu.Items.Add("View References", null, OnAnyReferenceClick);

                mnu.Items.Add("-", null, null);

                item = (ToolStripMenuItem)mnu.Items.Add("Table Info", null, null);
                item.DropDownItems.Add("Table Permissions", null, OnHelpPermissionClick);
                item.DropDownItems.Add("Column Permissions", null, OnHelpTableColumnPermissionClick);
                item.DropDownItems.Add("Foreign Keys", null, OnHelpForeignKeysClick);
                item.DropDownItems.Add("Foreign Key In", null, OnHelpForeignKeyInClick);
                item.DropDownItems.Add("Constraints", null, OnHelpConstraintsClick);
                item.DropDownItems.Add("Special Columns", null, OnHelpSpecialColumnsClick);
                item.DropDownItems.Add("-", null, null);
                item.DropDownItems.Add("Used Space", null, OnHelpUsedSpaceClick);
                item.DropDownItems.Add("Statistics", null, OnHelpStatisticsClick);

                mnu.Items.Add("Object Help", null, OnObjectHelpClick);
                mnu.Items.Add("Dependencies", null, OnHelpDependsClick);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("New Script", null, OnCreateScriptEditorClick);
                mnu.Items.Add("Refresh", null, OnRefreshNodeClick);
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu/SystemTable");
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu");
                break;

            case DBObjectType.View:
                mnu.Items.Add("Select Top 100 Rows", null, OnSelectTop100RowsClick);
                mnu.Items.Add("Open", null, OnOpenViewDataEditorClick);
                mnu.Items.Add("Modify", null, OnModifyClick);
                mnu.Items.Add("Modify (Append to current)", null, OnModifyInCurrentScriptEditorClick);
                mnu.Items.Add("Change History", null, OnShowObjectChangeHistory);

                mnu.Items.Add("-", null, null);
                mnu.Items.Add("View Columns", null, OnViewColumnsClick);
                mnu.Items.Add("View References", null, OnAnyReferenceClick);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Drop Object", null, OnDropObject);
                mnu.Items.Add("Generate Drop Script", null, OnGenerateDropScript);

                item = (ToolStripMenuItem)mnu.Items.Add("Diff", null, null);
                item.DropDownItems.Add("As Source", null, OnDiffAsSourceClick);
                item.DropDownItems.Add("As Dest", null, OnDiffAsDestClick);

                mnu.Items.Add("-", null, null);

                item = (ToolStripMenuItem)mnu.Items.Add("Info", null, null);
                item.DropDownItems.Add("Object Help", null, OnObjectHelpClick);
                item.DropDownItems.Add("Constraints", null, OnHelpConstraintsClick);
                item.DropDownItems.Add("View Permissions", null, OnHelpPermissionClick);
                item.DropDownItems.Add("Column Permissions", null, OnHelpTableColumnPermissionClick);

                mnu.Items.Add("Dependencies", null, OnHelpDependsClick);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Add Object To Group", null, OnAddSerlectedObjectsToGroup);
                mnu.Items.Add("Show Grouping Statistics", null, OnShowObjectGroupingStatistics);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("New Script", null, OnCreateScriptEditorClick);
                mnu.Items.Add("Refresh", null, OnRefreshNodeClick);
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu/View");
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu");
                break;

            case DBObjectType.Trigger:
                mnu.Items.Add("Modify", null, OnModifyClick);
                mnu.Items.Add("Modify (Append to current)", null, OnModifyInCurrentScriptEditorClick);
                mnu.Items.Add("Change History", null, OnShowObjectChangeHistory);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Drop Object", null, OnDropObject);
                mnu.Items.Add("Generate Drop Script", null, OnGenerateDropScript);

                mnu.Items.Add("-", null, null);

                item = (ToolStripMenuItem)mnu.Items.Add("Diff", null, null);
                item.DropDownItems.Add("As Source", null, OnDiffAsSourceClick);
                item.DropDownItems.Add("As Dest", null, OnDiffAsDestClick);

                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Object Help", null, OnObjectHelpClick);
                mnu.Items.Add("Dependencies", null, OnHelpDependsClick);
                mnu.Items.Add("Permissions", null, OnHelpObjectPermissionClick);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Add Object To Group", null, OnAddSerlectedObjectsToGroup);
                mnu.Items.Add("Show Grouping Statistics", null, OnShowObjectGroupingStatistics);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("New Script", null, OnCreateScriptEditorClick);
                mnu.Items.Add("Refresh", null, OnRefreshNodeClick);
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu/Trigger");
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu");
                break;

            case DBObjectType.StoredProc:
                mnu.Items.Add("Modify", null, OnModifyClick);
                mnu.Items.Add("Modify (Append to current)", null, OnModifyInCurrentScriptEditorClick);
                mnu.Items.Add("Execute", null, OnExecuteClick);
                mnu.Items.Add("Change History", null, OnShowObjectChangeHistory);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Drop Object", null, OnDropObject);
                mnu.Items.Add("Generate Drop Script", null, OnGenerateDropScript);

                mnu.Items.Add("View References", null, OnAnyReferenceClick);
                mnu.Items.Add("-", null, null);

                item = (ToolStripMenuItem)mnu.Items.Add("Diff", null, null);
                item.DropDownItems.Add("As Source", null, OnDiffAsSourceClick);
                item.DropDownItems.Add("As Dest", null, OnDiffAsDestClick);

                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Object Help", null, OnObjectHelpClick);
                mnu.Items.Add("Dependencies", null, OnHelpDependsClick);
                mnu.Items.Add("Permissions", null, OnHelpObjectPermissionClick);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Add Object To Group", null, OnAddSerlectedObjectsToGroup);
                mnu.Items.Add("Show Grouping Statistics", null, OnShowObjectGroupingStatistics);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("New Script", null, OnCreateScriptEditorClick);
                mnu.Items.Add("Refresh", null, OnRefreshNodeClick);
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu/StoredProcedure");
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu");
                break;

            case DBObjectType.Synonym:
                mnu.Items.Add("Synonym Properties", null, OnShowSynonymProperties);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Drop Object", null, OnDropObject);
                mnu.Items.Add("Generate Drop Script", null, OnGenerateDropScript);

                mnu.Items.Add("View References", null, OnAnyReferenceClick);
                mnu.Items.Add("-", null, null);

                item = (ToolStripMenuItem)mnu.Items.Add("Diff", null, null);
                item.DropDownItems.Add("As Source", null, OnDiffAsSourceClick);
                item.DropDownItems.Add("As Dest", null, OnDiffAsDestClick);

                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Object Help", null, OnObjectHelpClick);
                mnu.Items.Add("Dependencies", null, OnHelpDependsClick);
                mnu.Items.Add("Permissions", null, OnHelpObjectPermissionClick);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Add Object To Group", null, OnAddSerlectedObjectsToGroup);
                mnu.Items.Add("Show Grouping Statistics", null, OnShowObjectGroupingStatistics);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("New Script", null, OnCreateScriptEditorClick);
                mnu.Items.Add("Refresh", null, OnRefreshNodeClick);
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu/Synonym");
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu");
                break;

            case DBObjectType.TableValuedFunction:
                mnu.Items.Add("Modify", null, OnModifyClick);
                mnu.Items.Add("Modify (Append to current)", null, OnModifyInCurrentScriptEditorClick);
                mnu.Items.Add("Change History", null, OnShowObjectChangeHistory);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Drop Object", null, OnDropObject);
                mnu.Items.Add("Generate Drop Script", null, OnGenerateDropScript);

                mnu.Items.Add("View References", null, OnAnyReferenceClick);
                mnu.Items.Add("-", null, null);

                item = (ToolStripMenuItem)mnu.Items.Add("Diff", null, null);
                item.DropDownItems.Add("As Source", null, OnDiffAsSourceClick);
                item.DropDownItems.Add("As Dest", null, OnDiffAsDestClick);

                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Object Help", null, OnObjectHelpClick);
                mnu.Items.Add("Dependencies", null, OnHelpDependsClick);
                mnu.Items.Add("Permissions", null, OnHelpObjectPermissionClick);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Add Object To Group", null, OnAddSerlectedObjectsToGroup);
                mnu.Items.Add("Show Grouping Statistics", null, OnShowObjectGroupingStatistics);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("New Script", null, OnCreateScriptEditorClick);
                mnu.Items.Add("Refresh", null, OnRefreshNodeClick);
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu/TableValuedFunction");
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu");
                break;

            case DBObjectType.ScalarValuedFunction:
                mnu.Items.Add("Modify", null, OnModifyClick);
                mnu.Items.Add("Modify (Append to current)", null, OnModifyInCurrentScriptEditorClick);
                mnu.Items.Add("Change History", null, OnShowObjectChangeHistory);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Drop Object", null, OnDropObject);
                mnu.Items.Add("Generate Drop Script", null, OnGenerateDropScript);

                mnu.Items.Add("View References", null, OnAnyReferenceClick);
                mnu.Items.Add("-", null, null);

                item = (ToolStripMenuItem)mnu.Items.Add("Diff", null, null);
                item.DropDownItems.Add("As Source", null, OnDiffAsSourceClick);
                item.DropDownItems.Add("As Dest", null, OnDiffAsDestClick);

                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Object Help", null, OnObjectHelpClick);
                mnu.Items.Add("Dependencies", null, OnHelpDependsClick);
                mnu.Items.Add("Permissions", null, OnHelpObjectPermissionClick);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("Add Object To Group", null, OnAddSerlectedObjectsToGroup);
                mnu.Items.Add("Show Grouping Statistics", null, OnShowObjectGroupingStatistics);
                mnu.Items.Add("-", null, null);
                mnu.Items.Add("New Script", null, OnCreateScriptEditorClick);
                mnu.Items.Add("Refresh", null, OnRefreshNodeClick);
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu/ScalarValuedFunction");
                MenuService.AddItemsToMenu(mnu.Items, this, "/Workspace/ObjectExplorer/ContextMenu");
                break;

            default:
                break;
            }

            if (mnu != null)
            {
                _contextMenus.Add(objectType, mnu);
            }

            return(mnu);
        }
示例#15
0
 public void AddRibbonPageCategory(string addInTreePath)//当需要扩展功能时,激活Category标签页
 {
     RemoveRibbonPageCategory();
     MenuService.AddItemsToMenu(this.ribbon.PageCategories, this, addInTreePath);
 }
示例#16
0
        public void Initialize()
        {
            try
            {
                SplashScreenManager.ShowForm(this, typeof(MainAppSplashScreen), true, true);
                SplashScreenManager.Default.SendCommand(null, "开始启动系统......");
                SplashScreenManager.Default.SendCommand(null, "开始初始化主窗体控件......");
                string systemType = SystemInfo.Instance.SystemType;
                if (systemType == "2D" || systemType == "3D")
                {
                    //先创建View再创建Pad
                    SplashScreenManager.Default.SendCommand(null, "开始初始化视图......");
                    UCService.AddViews(this, "/Workbench/View/" + systemType);
                    UCService.CreateViews(components, dockManager, tabbedView);

                    SplashScreenManager.Default.SendCommand(null, "开始初始化面板......");
                    UCService.AddPads(this, "/Workbench/Pad/" + systemType);
                    UCService.CreatePads(this, dockManager);

                    AutoStartCmds("/Workspace/Autostart/" + systemType);

                    SplashScreenManager.Default.SendCommand(null, "正在加载菜单......");
                    MenuService.AddItemsToMenu(this.ribbon.Pages, this, "/Workbench/MainMenu/" + systemType);
                    MenuService.AddItemsToMenu(this.ribbon.Pages, this, "/Workbench/MainMenu");
                    if (this.ribbon.Pages.Count > 0)
                    {
                        this.ribbon.SelectedPage = this.ribbon.Pages[0];
                    }
                    MenuService.AddQuickToolBar(this.ribbon.Items, this.ribbon.Toolbar.ItemLinks);
                    MenuService.AddApplicationMenu(this.appMenu.ItemLinks, this, "/Workbench/ApplicationMenu");
                }
                else
                {
                    //先创建View再创建Pad
                    SplashScreenManager.Default.SendCommand(null, "开始初始化视图......");
                    UCService.AddViews(this, "/Workbench/View/2D");
                    UCService.AddViews(this, "/Workbench/View/3D");
                    UCService.CreateViews(components, dockManager, tabbedView);

                    SplashScreenManager.Default.SendCommand(null, "开始初始化面板......");
                    UCService.AddPads(this, "/Workbench/Pad/2D");
                    UCService.AddPads(this, "/Workbench/Pad/3D");
                    UCService.CreatePads(this, dockManager);

                    AutoStartCmds("/Workspace/Autostart/2D");
                    AutoStartCmds("/Workspace/Autostart/3D");

                    SplashScreenManager.Default.SendCommand(null, "正在加载菜单......");
                    MenuService.AddItemsToMenu(this.ribbon.Pages, this, "/Workbench/MainMenu/2D");
                    MenuService.AddItemsToMenu(this.ribbon.Pages, this, "/Workbench/MainMenu/3D");
                    MenuService.AddItemsToMenu(this.ribbon.Pages, this, "/Workbench/MainMenu");
                    if (this.ribbon.Pages.Count > 0)
                    {
                        this.ribbon.SelectedPage = this.ribbon.Pages[0];
                    }
                    MenuService.AddQuickToolBar(this.ribbon.Items, this.ribbon.Toolbar.ItemLinks);
                    MenuService.AddApplicationMenu(this.appMenu.ItemLinks, this, "/Workbench/ApplicationMenu");
                }
                SplashScreenManager.CloseForm();
                //this.ribbon.Minimized = true;
            }
            catch (Exception ex)
            {
                LoggingService.Error(ex.Message + "\r\n" + ex.StackTrace);
            }
        }