Пример #1
0
        public TableContextMenu(MenuCommandParameters menuCommandParameters, ExplorerToolWindow parent)
        {
            var isSqlCe = menuCommandParameters.DatabaseInfo.DatabaseType == DatabaseType.SQLCE35 ||
                          menuCommandParameters.DatabaseInfo.DatabaseType == DatabaseType.SQLCE40;
            var isSqlite = menuCommandParameters.DatabaseInfo.DatabaseType == DatabaseType.SQLite;

            var tcmd = new TableMenuCommandsHandler(parent);

            //Edit menu
            CreateEditTableDataMenuItem(tcmd, menuCommandParameters);
            ReportDataMenuItem(tcmd, menuCommandParameters);
            AddSqlEditorItem(tcmd, menuCommandParameters);
            Items.Add(new Separator());
            if (isSqlCe)
            {
                AddColumnMenuItem(tcmd, menuCommandParameters);
                AddIndexMenuItem(tcmd, menuCommandParameters);
                AddFkMenuItem(tcmd, menuCommandParameters);
                Items.Add(new Separator());
            }
            CreateScriptAsCreateMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsDropMenuItem(tcmd, menuCommandParameters);
            if (!isSqlite)
            {
                CreateScriptAsDropAndCreateMenuItem(tcmd, menuCommandParameters);
            }
            Items.Add(new Separator());
            CreateScriptAsSelectMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsInsertMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsUpdateMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsDeleteMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsDataMenuItem(tcmd, menuCommandParameters);
#if SSMS
            if (isSqlCe)
            {
                CreateScriptAsSQLCLRSampleMenuItem(tcmd, menuCommandParameters);
            }
#endif
            Items.Add(new Separator());
            ImportDataMenuItem(tcmd, menuCommandParameters);
            Items.Add(new Separator());
            if (isSqlCe)
            {
                CompareDataMenuItem(tcmd, menuCommandParameters);
                Items.Add(new Separator());
            }
            RenameMenuItem(tcmd, menuCommandParameters);
            if (isSqlCe)
            {
                DescriptionMenuItem(tcmd, menuCommandParameters);
            }
        }
Пример #2
0
        private void ReportDataMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
        {
            var scriptCommandBinding = new CommandBinding(TableMenuCommands.TableCommand, tcmd.ReportTableData);
            var scriptMenuItem       = new MenuItem
            {
                Header           = "View Data as Report",
                Icon             = ImageHelper.GetImageFromResource("../resources/Tables_8928.png"),
                Command          = TableMenuCommands.TableCommand,
                CommandParameter = menuCommandParameters
            };

            scriptMenuItem.CommandBindings.Add(scriptCommandBinding);
            Items.Add(scriptMenuItem);
        }
Пример #3
0
        private void RenameMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
        {
            var scriptCommandBinding = new CommandBinding(TableMenuCommands.TableCommand, tcmd.Rename);
            var scriptMenuItem       = new MenuItem
            {
                Header           = "Rename...",
                Icon             = ImageHelper.GetImageFromResource("../resources/Rename_6779.png"),
                Command          = TableMenuCommands.TableCommand,
                CommandParameter = menuCommandParameters
            };

            scriptMenuItem.CommandBindings.Add(scriptCommandBinding);
            Items.Add(scriptMenuItem);
        }
Пример #4
0
        private void CompareDataMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
        {
            var scriptCommandBinding = new CommandBinding(TableMenuCommands.TableCommand, tcmd.GenerateDataDiffScript);
            var scriptMenuItem       = new MenuItem
            {
                Header           = "Compare Data (beta)...",
                Icon             = ImageHelper.GetImageFromResource("../resources/DataCompare_9880.png"),
                Command          = TableMenuCommands.TableCommand,
                CommandParameter = menuCommandParameters
            };

            scriptMenuItem.CommandBindings.Add(scriptCommandBinding);
            Items.Add(scriptMenuItem);
        }
Пример #5
0
        private void ImportDataMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
        {
            var scriptCommandBinding = new CommandBinding(TableMenuCommands.TableCommand, tcmd.ImportData);
            var scriptMenuItem       = new MenuItem
            {
                Header           = "Import Data from CSV...",
                Icon             = ImageHelper.GetImageFromResource("../resources/TypeDefinition_521.png"),
                Command          = TableMenuCommands.TableCommand,
                CommandParameter = menuCommandParameters
            };

            scriptMenuItem.CommandBindings.Add(scriptCommandBinding);
            Items.Add(scriptMenuItem);
        }
Пример #6
0
        // ReSharper disable once InconsistentNaming
        // ReSharper disable once UnusedMember.Local
        private void CreateScriptAsSQLCLRSampleMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
        {
            var scriptCommandBinding = new CommandBinding(TableMenuCommands.TableCommand, tcmd.ScriptAsSQLCLRSample);
            var scriptMenuItem       = new MenuItem
            {
                Header           = "Script as SQLCLR sample (beta)",
                Icon             = ImageHelper.GetImageFromResource("../resources/script_16xLG.png"),
                Command          = TableMenuCommands.TableCommand,
                CommandParameter = menuCommandParameters
            };

            scriptMenuItem.CommandBindings.Add(scriptCommandBinding);
            Items.Add(scriptMenuItem);
        }
        private void CreateScriptAsInsertMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
        {
            var scriptCommandBinding = new CommandBinding(TableMenuCommands.TableCommand, tcmd.ScriptAsInsert);
            var scriptMenuItem       = new MenuItem
            {
                Header           = "Script as INSERT",
                Icon             = ImageHelper.GetImageFromResource("../resources/sp.png"),
                Command          = TableMenuCommands.TableCommand,
                CommandParameter = menuCommandParameters
            };

            scriptMenuItem.CommandBindings.Add(scriptCommandBinding);
            Items.Add(scriptMenuItem);
        }
Пример #8
0
        private void AddColumnMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
        {
            var modifyTableCommandBinding = new CommandBinding(TableMenuCommands.TableCommand,
                                                               tcmd.AddColumn);
            var modifyTableMenuItem = new MenuItem
            {
                Header           = "Add column... (beta)",
                Icon             = ImageHelper.GetImageFromResource("../resources/table_16xLG.png"),
                Command          = TableMenuCommands.TableCommand,
                CommandParameter = menuCommandParameters
            };

            modifyTableMenuItem.CommandBindings.Add(modifyTableCommandBinding);
            Items.Add(modifyTableMenuItem);
        }
Пример #9
0
        private void CreateEditTableDataMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
        {
            var editTableCommandBinding = new CommandBinding(TableMenuCommands.TableCommand,
                                                             tcmd.EditTableData);
            var editTableMenuItem = new MenuItem
            {
                Header           = string.Format("Edit Top {0} Rows", Properties.Settings.Default.MaxRowsToEdit),
                Icon             = ImageHelper.GetImageFromResource("../resources/Editdatasetwithdesigner_8449.png"),
                Command          = TableMenuCommands.TableCommand,
                CommandParameter = menuCommandParameters
            };

            editTableMenuItem.CommandBindings.Add(editTableCommandBinding);
            Items.Add(editTableMenuItem);
        }
Пример #10
0
        private void AddSqlEditorItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
        {
            var showSqlEditorCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand,
                                                                 tcmd.SpawnSqlEditorWindow);
            var showSqlEditorMenuItem = new MenuItem
            {
                Header           = "New Query",
                Icon             = ImageHelper.GetImageFromResource("../resources/NewQuery.png"),
                Command          = DatabaseMenuCommands.DatabaseCommand,
                CommandParameter = menuCommandParameters
            };

            showSqlEditorMenuItem.CommandBindings.Add(showSqlEditorCommandBinding);
            Items.Add(showSqlEditorMenuItem);
        }
Пример #11
0
        private void AddFkMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
        {
            var addFkCommandBinding = new CommandBinding(TableMenuCommands.TableCommand,
                                                         tcmd.AddForeignKey);
            var addFkMenuItem = new MenuItem
            {
                Header           = "Add foreign key... (beta)",
                Icon             = ImageHelper.GetImageFromResource("../resources/table_16xLG.png"),
                Command          = TableMenuCommands.TableCommand,
                CommandParameter = menuCommandParameters
            };

            addFkMenuItem.CommandBindings.Add(addFkCommandBinding);
            Items.Add(addFkMenuItem);
        }
        private void DescriptionMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
        {
            var addDescriptionCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand,
                                                                  tcmd.AddDescription);
            var addDescriptionMenuItem = new MenuItem
            {
                Header           = "Edit description",
                Icon             = ImageHelper.GetImageFromResource("../resources/propes.png"),
                Command          = DatabaseMenuCommands.DatabaseCommand,
                CommandParameter = menuCommandParameters
            };

            addDescriptionMenuItem.CommandBindings.Add(addDescriptionCommandBinding);
            Items.Add(addDescriptionMenuItem);
        }
        private void CreateViewReportMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
        {
            var viewReportCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand,
                                                              tcmd.SpawnReportViewerWindow);
            var reportMenuItem = new MenuItem
            {
                Header           = "View Data as Report",
                Icon             = ImageHelper.GetImageFromResource("../resources/sqlEditor.png"),
                Command          = DatabaseMenuCommands.DatabaseCommand,
                CommandParameter = menuCommandParameters
            };

            reportMenuItem.CommandBindings.Add(viewReportCommandBinding);
            Items.Add(reportMenuItem);
        }
        private void CreateEditDataMenuItem(TableMenuCommandsHandler tcmd, MenuCommandParameters menuCommandParameters)
        {
            var editTableCommandBinding = new CommandBinding(DatabaseMenuCommands.DatabaseCommand,
                                                             tcmd.SpawnDataEditorWindow);
            var editTableMenuItem = new MenuItem
            {
                Header           = string.Format("Edit Top {0} Rows", Properties.Settings.Default.MaxRowsToEdit),
                Icon             = ImageHelper.GetImageFromResource("../resources/sqlEditor.png"),
                Command          = DatabaseMenuCommands.DatabaseCommand,
                CommandParameter = menuCommandParameters
            };

            editTableMenuItem.CommandBindings.Add(editTableCommandBinding);
            Items.Add(editTableMenuItem);
        }
        public TableContextMenu(MenuCommandParameters menuCommandParameters, ExplorerControl parent)
        {
            var tcmd = new TableMenuCommandsHandler(parent);

            CreateEditDataMenuItem(tcmd, menuCommandParameters);
            CreateViewReportMenuItem(tcmd, menuCommandParameters);
            Items.Add(new Separator());
            CreateScriptAsCreateMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsDropMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsDropAndCreateMenuItem(tcmd, menuCommandParameters);
            Items.Add(new Separator());
            CreateScriptAsSelectMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsInsertMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsUpdateMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsDeleteMenuItem(tcmd, menuCommandParameters);
            CreateScriptAsDataMenuItem(tcmd, menuCommandParameters);
            Items.Add(new Separator());
            ImportDataMenuItem(tcmd, menuCommandParameters);
            Items.Add(new Separator());
            DescriptionMenuItem(tcmd, menuCommandParameters);
            Items.Add(new Separator());
            RenameMenuItem(tcmd, menuCommandParameters);
        }