public ViewEditorDialog (ISchemaProvider schemaProvider, bool create, ViewEditorSettings settings) { if (schemaProvider == null) throw new ArgumentNullException ("schemaProvider"); this.schemaProvider = schemaProvider; this.action = create ? SchemaActions.Create : SchemaActions.Alter; this.Build(); if (create) Title = AddinCatalog.GetString ("Create View"); else Title = AddinCatalog.GetString ("Alter View"); notebook = new Notebook (); sqlEditor = new SqlEditorWidget (); sqlEditor.TextChanged += new EventHandler (SqlChanged); notebook.AppendPage (sqlEditor, new Label (AddinCatalog.GetString ("Definition"))); if (settings.ShowComment) { commentEditor = new CommentEditorWidget (); notebook.AppendPage (commentEditor, new Label (AddinCatalog.GetString ("Comment"))); } notebook.Page = 0; entryName.Text = view.Name; vboxContent.PackStart (notebook, true, true, 0); vboxContent.ShowAll (); SetWarning (null); }
public ViewEditorDialog(ISchemaProvider schemaProvider, ViewSchema view, bool create) { if (schemaProvider == null) { throw new ArgumentNullException("schemaProvider"); } if (view == null) { throw new ArgumentNullException("view"); } this.schemaProvider = schemaProvider; this.view = view; this.action = create ? SchemaActions.Create : SchemaActions.Alter; this.Build(); if (create) { Title = GettextCatalog.GetString("Create View"); } else { Title = GettextCatalog.GetString("Alter View"); } notebook = new Notebook(); sqlEditor = new SqlEditorWidget(); sqlEditor.TextChanged += new EventHandler(SqlChanged); notebook.AppendPage(sqlEditor, new Label(GettextCatalog.GetString("Definition"))); IDbFactory fac = schemaProvider.ConnectionPool.DbFactory; if (fac.IsCapabilitySupported("View", action, ViewCapabilities.Comment)) { commentEditor = new CommentEditorWidget(); notebook.AppendPage(commentEditor, new Label(GettextCatalog.GetString("Comment"))); } notebook.Page = 0; entryName.Text = view.Name; if (!create) { sqlEditor.Text = schemaProvider.GetViewAlterStatement(view); commentEditor.Comment = view.Comment; } vboxContent.PackStart(notebook, true, true, 0); vboxContent.ShowAll(); SetWarning(null); }
public ProcedureEditorDialog(IEditSchemaProvider schemaProvider, bool create, ProcedureEditorSettings settings) { if (schemaProvider == null) { throw new ArgumentNullException("schemaProvider"); } this.settings = settings; this.schemaProvider = schemaProvider; this.action = create ? SchemaActions.Create : SchemaActions.Alter; this.Build(); if (create) { Title = AddinCatalog.GetString("Create Procedure"); } else { Title = AddinCatalog.GetString("Alter Procedure"); } notebook = new Notebook(); sqlEditor = new SqlEditorWidget(); sqlEditor.TextChanged += new EventHandler(SqlChanged); notebook.AppendPage(sqlEditor, new Label(AddinCatalog.GetString("Definition"))); if (settings.ShowComment) { commentEditor = new CommentEditorWidget(); notebook.AppendPage(commentEditor, new Label(AddinCatalog.GetString("Comment"))); } if (!settings.ShowName) { nameLabel.Visible = false; entryName.Visible = false; } vboxContent.PackStart(notebook, true, true, 0); vboxContent.ShowAll(); SetWarning(null); }
public ViewEditorDialog (ISchemaProvider schemaProvider, ViewSchema view, bool create) { if (schemaProvider == null) throw new ArgumentNullException ("schemaProvider"); if (view == null) throw new ArgumentNullException ("view"); this.schemaProvider = schemaProvider; this.view = view; this.action = create ? SchemaActions.Create : SchemaActions.Alter; this.Build(); if (create) Title = GettextCatalog.GetString ("Create View"); else Title = GettextCatalog.GetString ("Alter View"); notebook = new Notebook (); sqlEditor = new SqlEditorWidget (); sqlEditor.TextChanged += new EventHandler (SqlChanged); notebook.AppendPage (sqlEditor, new Label (GettextCatalog.GetString ("Definition"))); IDbFactory fac = schemaProvider.ConnectionPool.DbFactory; if (fac.IsCapabilitySupported ("View", action, ViewCapabilities.Comment)) { commentEditor = new CommentEditorWidget (); notebook.AppendPage (commentEditor, new Label (GettextCatalog.GetString ("Comment"))); } notebook.Page = 0; entryName.Text = view.Name; if (!create) { sqlEditor.Text = schemaProvider.GetViewAlterStatement (view); commentEditor.Comment = view.Comment; } vboxContent.PackStart (notebook, true, true, 0); vboxContent.ShowAll (); SetWarning (null); }
public TableEditorDialog(ISchemaProvider schemaProvider, TableSchema table, bool create) { if (schemaProvider == null) { throw new ArgumentNullException("schemaProvider"); } if (table == null) { throw new ArgumentNullException("table"); } this.schemaProvider = schemaProvider; this.originalTable = table; this.table = table; this.action = create ? SchemaActions.Create : SchemaActions.Alter; this.Build(); if (create) { Title = GettextCatalog.GetString("Create Table"); } else { Title = GettextCatalog.GetString("Alter Table"); } notebook = new Notebook(); vboxContent.PackStart(notebook, true, true, 0); columnEditor = new ColumnsEditorWidget(schemaProvider, action); columnEditor.ContentChanged += new EventHandler(OnContentChanged); notebook.AppendPage(columnEditor, new Label(GettextCatalog.GetString("Columns"))); //TODO: there is a diff between col and table constraints IDbFactory fac = schemaProvider.ConnectionPool.DbFactory; if (fac.IsCapabilitySupported("Table", action, TableCapabilities.Constraints)) { constraintEditor = new ConstraintsEditorWidget(schemaProvider, action); constraintEditor.ContentChanged += new EventHandler(OnContentChanged); notebook.AppendPage(constraintEditor, new Label(GettextCatalog.GetString("Constraints"))); } //TODO: //indexEditor = new IndicesEditorWidget (schemaProvider); //notebook.AppendPage (indexEditor, new Label (GettextCatalog.GetString ("Indexes"))); if (fac.IsCapabilitySupported("Table", action, TableCapabilities.Trigger)) { triggerEditor = new TriggersEditorWidget(schemaProvider, action); triggerEditor.ContentChanged += new EventHandler(OnContentChanged); notebook.AppendPage(triggerEditor, new Label(GettextCatalog.GetString("Triggers"))); } if (fac.IsCapabilitySupported("Table", action, TableCapabilities.Comment)) { commentEditor = new CommentEditorWidget(); notebook.AppendPage(commentEditor, new Label(GettextCatalog.GetString("Comment"))); } notebook.Page = 0; entryName.Text = originalTable.Name; WaitDialog.ShowDialog("Loading table data ..."); notebook.Sensitive = false; ThreadPool.QueueUserWorkItem(new WaitCallback(InitializeThreaded)); vboxContent.ShowAll(); SetWarning(null); }
public void Initialize (TableSchema table) { if (table == null) throw new ArgumentNullException ("table"); this.originalTable = table; this.table = table; SetWarning (null); columnEditor = new ColumnsEditorWidget (schemaProvider, action, settings.ColumnSettings); columnEditor.ContentChanged += new EventHandler (OnContentChanged); // When primary Key are selected on the "Column Editor", it has to refresh the "Primary Key" Widget. columnEditor.PrimaryKeyChanged += delegate(object sender, EventArgs e) { if (constraintEditor != null) constraintEditor.RefreshConstraints (); }; notebook.AppendPage (columnEditor, new Label (AddinCatalog.GetString ("Columns"))); if (settings.ShowConstraints) { constraintEditor = new ConstraintsEditorWidget (schemaProvider, action, settings.ConstraintSettings); constraintEditor.ContentChanged += new EventHandler (OnContentChanged); notebook.AppendPage (constraintEditor, new Label (AddinCatalog.GetString ("Constraints"))); // If Primary Key are changed on it has to refresh the "Column Editor" Widget to select the correct // columns constraintEditor.PrimaryKeyChanged += delegate(object sender, EventArgs e) { columnEditor.RefreshConstraints (); }; } //TODO: Implement Index /* if (settings.ShowIndices) { indexEditor = new IndicesEditorWidget (schemaProvider, action); indexEditor.ContentChanged += OnContentChanged; notebook.AppendPage (indexEditor, new Label (AddinCatalog.GetString ("Indexes"))); } */ if (settings.ShowTriggers) { triggerEditor = new TriggersEditorWidget (schemaProvider, action); triggerEditor.ContentChanged += new EventHandler (OnContentChanged); notebook.AppendPage (triggerEditor, new Label (AddinCatalog.GetString ("Triggers"))); } if (settings.ShowComment) { commentEditor = new CommentEditorWidget (); notebook.AppendPage (commentEditor, new Label (AddinCatalog.GetString ("Comment"))); } notebook.Page = 0; entryName.Text = originalTable.Name; WaitDialog.ShowDialog ("Loading table data ..."); }
public TableEditorDialog (ISchemaProvider schemaProvider, TableSchema table, bool create) { if (schemaProvider == null) throw new ArgumentNullException ("schemaProvider"); if (table == null) throw new ArgumentNullException ("table"); this.schemaProvider = schemaProvider; this.originalTable = table; this.table = table; this.action = create ? SchemaActions.Create : SchemaActions.Alter; this.Build(); if (create) Title = GettextCatalog.GetString ("Create Table"); else Title = GettextCatalog.GetString ("Alter Table"); notebook = new Notebook (); vboxContent.PackStart (notebook, true, true, 0); columnEditor = new ColumnsEditorWidget (schemaProvider, action); columnEditor.ContentChanged += new EventHandler (OnContentChanged); notebook.AppendPage (columnEditor, new Label (GettextCatalog.GetString ("Columns"))); //TODO: there is a diff between col and table constraints IDbFactory fac = schemaProvider.ConnectionPool.DbFactory; if (fac.IsCapabilitySupported ("Table", action, TableCapabilities.Constraints)) { constraintEditor = new ConstraintsEditorWidget (schemaProvider, action); constraintEditor.ContentChanged += new EventHandler (OnContentChanged); notebook.AppendPage (constraintEditor, new Label (GettextCatalog.GetString ("Constraints"))); } //TODO: //indexEditor = new IndicesEditorWidget (schemaProvider); //notebook.AppendPage (indexEditor, new Label (GettextCatalog.GetString ("Indexes"))); if (fac.IsCapabilitySupported ("Table", action, TableCapabilities.Trigger)) { triggerEditor = new TriggersEditorWidget (schemaProvider, action); triggerEditor.ContentChanged += new EventHandler (OnContentChanged); notebook.AppendPage (triggerEditor, new Label (GettextCatalog.GetString ("Triggers"))); } if (fac.IsCapabilitySupported ("Table", action, TableCapabilities.Comment)) { commentEditor = new CommentEditorWidget (); notebook.AppendPage (commentEditor, new Label (GettextCatalog.GetString ("Comment"))); } notebook.Page = 0; entryName.Text = originalTable.Name; WaitDialog.ShowDialog ("Loading table data ..."); notebook.Sensitive = false; ThreadPool.QueueUserWorkItem (new WaitCallback (InitializeThreaded)); vboxContent.ShowAll (); SetWarning (null); }
public void Initialize(TableSchema table) { if (table == null) { throw new ArgumentNullException("table"); } this.originalTable = table; this.table = table; SetWarning(null); columnEditor = new ColumnsEditorWidget(schemaProvider, action, settings.ColumnSettings); columnEditor.ContentChanged += new EventHandler(OnContentChanged); // When primary Key are selected on the "Column Editor", it has to refresh the "Primary Key" Widget. columnEditor.PrimaryKeyChanged += delegate(object sender, EventArgs e) { if (constraintEditor != null) { constraintEditor.RefreshConstraints(); } }; notebook.AppendPage(columnEditor, new Label(AddinCatalog.GetString("Columns"))); if (settings.ShowConstraints) { constraintEditor = new ConstraintsEditorWidget(schemaProvider, action, settings.ConstraintSettings); constraintEditor.ContentChanged += new EventHandler(OnContentChanged); notebook.AppendPage(constraintEditor, new Label(AddinCatalog.GetString("Constraints"))); // If Primary Key are changed on it has to refresh the "Column Editor" Widget to select the correct // columns constraintEditor.PrimaryKeyChanged += delegate(object sender, EventArgs e) { columnEditor.RefreshConstraints(); }; } //TODO: Implement Index /* * if (settings.ShowIndices) { * indexEditor = new IndicesEditorWidget (schemaProvider, action); * indexEditor.ContentChanged += OnContentChanged; * notebook.AppendPage (indexEditor, new Label (AddinCatalog.GetString ("Indexes"))); * } */ if (settings.ShowTriggers) { triggerEditor = new TriggersEditorWidget(schemaProvider, action); triggerEditor.ContentChanged += new EventHandler(OnContentChanged); notebook.AppendPage(triggerEditor, new Label(AddinCatalog.GetString("Triggers"))); } if (settings.ShowComment) { commentEditor = new CommentEditorWidget(); notebook.AppendPage(commentEditor, new Label(AddinCatalog.GetString("Comment"))); } notebook.Page = 0; entryName.Text = originalTable.Name; WaitDialog.ShowDialog("Loading table data ..."); }