示例#1
0
        private ISchemaEditor GetSchemaEditor(DBSchemaItemRef itemref)
        {
            ISchemaEditor ed = null;

            switch (itemref.Type)
            {
            case DBSchemaTypes.Table:
                ed = new Controls.SchemaTableEditor();
                break;

            case DBSchemaTypes.View:
                ed = new Controls.SchemaViewEditor();
                break;

            case DBSchemaTypes.StoredProcedure:
                ed = new Controls.SchemaSprocEditor();
                break;

            case DBSchemaTypes.Function:
                ed = new Controls.SchemaFunctionEditor();
                break;

            case DBSchemaTypes.Index:
                ed = new Controls.SchemaIndexEditor();
                break;

            case (DBSchemaTypes.ForeignKey):
                ed = new Controls.SchemaForeignKeyEditor();
                break;

            case DBSchemaTypes.CommandScripts:
                break;

            default:
                break;
            }
            return(ed);
        }
示例#2
0
        protected virtual void EditNode(TreeNode node)
        {
            DBSchemaItemRef itemref  = (DBSchemaItemRef)node.Tag;
            string          fullname = itemref.ToString();

            if (this.tabControl1.TabPages.ContainsKey(fullname))
            {
                this.tabControl1.SelectedTab = this.tabControl1.TabPages[fullname];
            }
            else
            {
                ISchemaEditor editor = this.GetSchemaEditor(itemref);
                if (editor != null)
                {
                    try
                    {
                        DBSchemaItem item = this.provider.GetSchema(itemref);
                        editor.Item = item;

                        Control ctl  = editor.UIControl;
                        string  full = itemref.ToString();
                        this.tabControl1.TabPages.Add(full, itemref.Name);
                        TabPage pg = this.tabControl1.TabPages[full];
                        Perceiveit.Data.SchemaTests.Controls.EditorWraper wrapper = new Perceiveit.Data.SchemaTests.Controls.EditorWraper();
                        wrapper.InnerEditor   = editor;
                        wrapper.RequestClose += new EventHandler(wrapper_RequestClose);
                        pg.Controls.Add(wrapper);
                        ctl.Dock     = DockStyle.Fill;
                        wrapper.Dock = DockStyle.Fill;
                        this.tabControl1.SelectedTab = pg;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Could not load the schema editor :" + ex.Message + "\r\n\r\n" + ex.StackTrace);
                    }
                }
            }
        }