コード例 #1
0
        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);
        }
コード例 #2
0
		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);
		}
コード例 #3
0
		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 ...");
		}
コード例 #4
0
        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 ...");
        }