public void UpdateForForm(UIForm form)
        {
            if (valueInspectorModel != null)
            valueInspectorModel.DetachEvents();

              propertiesTreeView.SuspendLayout();
              propertiesTreeView.Model = null;
              valueInspector = null;
              valueInspectorModel = null;

              if (form != null)
              {
            List<String> items;

            valueInspector = wbContext.get_inspector_for_selection(form, out items);

            if (valueInspector != null)
            {
              valueInspectorModel = new SimpleGrtTreeModel(propertiesTreeView, valueInspector, false);
              valueInspectorModel.AddColumn(nameNodeControl, (int)GrtValueInspector.Columns.Name, false);
              //!valueInspectorModel.AddColumn(_valueNodeControl, (int)GrtValueInspector.Columns.Value, true);
              _valueNodeControl.GrtTreeModel = valueInspectorModel.GrtTree;

              {
            TreeModelTooltipProvider tp = new TreeModelTooltipProvider();
            tp.Model = valueInspectorModel.GrtTree;
            tp.TooltipColumn = (int)GrtValueInspector.Columns.Description;
            nameNodeControl.ToolTipProvider = tp;
            _valueNodeControl.ToolTipProvider = tp;
              }

              propertiesTreeView.Model = valueInspectorModel;

             // TabText = "Selection Properties";
            }
              }

              propertiesTreeView.ResumeLayout();
        }
        public DbObjectEditorPages(GrtManager GrtManager, DBObjectEditorWrapper DbObjectEditorBE)
            : this()
        {
            grtManager = GrtManager;
              dbObjectEditorBE = DbObjectEditorBE;

              // initialize roles based on passed object
              roleTreeBE = new RoleTreeBE(DbObjectEditorBE.get_catalog());

              roleTreeModel = new SimpleGrtTreeModel(allRolesTreeView, roleTreeBE, false);
              roleTreeModel.AddColumn(allRolesNameNodeControl, (int)RoleTreeBE.Columns.Name, false);
              allRolesTreeView.Model = roleTreeModel;

              objectRoleListBE = new ObjectRoleListWrapper(dbObjectEditorBE);
              objectRoleListModel = new SimpleGrtListModel(rolesTreeView, objectRoleListBE, false);
              objectRoleListModel.AddColumn(roleNameNodeControl, (int)ObjectRoleListWrapper.Columns.Name, false);
              rolesTreeView.Model = objectRoleListModel;

              objectPrivsListBE = objectRoleListBE.get_privilege_list();

              RefreshPrivilegesList();
        }
        protected void InitFormData()
        {
            int current_page = mainTabControl.SelectedIndex;

              schemaLabel.Text = tableEditorBE.get_schema_name();

              // Init Columns TreeView
              columnsTreeView.SelectedNode = null;
              if (columnsTreeView.Model != null && columnsTreeView.Model is DbMysqlTableColumnsListModel)
            (columnsTreeView.Model as DbMysqlTableColumnsListModel).DetachEvents();

              columnsListModel = new DbMysqlTableColumnsListModel(this, columnsTreeView, tableEditorBE.get_columns(),
            columnIconNodeControl, nameNodeControl, datatypeComboBoxNodeControl, pkNodeControl,
            nnNodeControl, uqNodeControl, binNodeControl, unNodeControl, zfNodeControl, aiNodeControl,
            gNodeControl, defaultNodeControl, tableEditorBE);

              nameNodeControl.IsEditEnabledValueNeeded += new EventHandler<Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs>(canEdit);
              datatypeComboBoxNodeControl.IsEditEnabledValueNeeded += new EventHandler<Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs>(canEdit);
              defaultNodeControl.IsEditEnabledValueNeeded += new EventHandler<Aga.Controls.Tree.NodeControls.NodeControlValueEventArgs>(canEdit);

              columnCommentTextBox.Text = "";
              columnCommentTextBox.Enabled = false;

              columnsTreeView.Model = columnsListModel;
              columnsTreeView.Refresh();

              // Init Index TreeView
              indicesTreeView.SelectedNode = null;
              if (indicesTreeView.Model != null && indicesTreeView.Model is DbMysqlTableIndicesListModel)
            (indicesTreeView.Model as DbMysqlTableIndicesListModel).DetachEvents();

              indicesListModel = new DbMysqlTableIndicesListModel(indicesTreeView, tableEditorBE.get_indexes(),
            indexNameNodeControl, indexTypeNodeControl, indexColumnNameNodeControl, tableEditorBE);
              indicesTreeView.Model = indicesListModel;
              indicesTreeView.Refresh();

              // Init FK TreeView
              fkTreeView.SelectedNode = null;
              if (fkTreeView.Model != null && fkTreeView.Model is DbMysqlTableFkListModel)
            (fkTreeView.Model as DbMysqlTableFkListModel).DetachEvents();

              fkListModel = new DbMysqlTableFkListModel(fkTreeView, tableEditorBE.get_fks(),
            nameFkNodeControl, targetFkNodeControl, tableEditorBE, columnEnabledFkNodeControl);
              fkTreeView.Model = fkListModel;
              fkTreeView.Refresh();

              // fk actions
              onDeleteActionComboBox.Enabled = true;
              onDeleteActionComboBox.Items.Clear();
              onUpdateActionComboBox.Enabled = true;
              onUpdateActionComboBox.Items.Clear();

              onDeleteActionComboBox.BeginUpdate();
              onUpdateActionComboBox.BeginUpdate();

              try
              {
            System.Collections.Generic.List<String> fk_action_options_list = tableEditorBE.get_fk_action_options();
            foreach (String fk_action in fk_action_options_list)
            {
              onDeleteActionComboBox.Items.Add(fk_action);
              onUpdateActionComboBox.Items.Add(fk_action);
            }
              }
              finally
              {
            onDeleteActionComboBox.EndUpdate();
            onUpdateActionComboBox.EndUpdate();
              }
              // index storage types
              indexStorageTypeComboBox.Enabled = true;
              indexStorageTypeComboBox.Items.Clear();
              System.Collections.Generic.List<String> index_storage_types_list = tableEditorBE.get_index_storage_types();
              foreach (String storage_type in index_storage_types_list)
              {
            indexStorageTypeComboBox.Items.Add(storage_type);
              }

              // engines
              optEngine.Enabled = true;
              optEngine.Items.Clear();
              System.Collections.Generic.List<String> engines_list = tableEditorBE.get_engines_list();
              foreach (String engine in engines_list)
              {
            optEngine.Items.Add(engine);
              }

              System.Collections.Generic.List<String> collations_list = tableEditorBE.get_charset_collation_list();

              optCollation.Items.Clear();
              optCollation.Items.Add("Schema Default");

              columnCollationComboBox.Enabled = false;
              columnCollationComboBox.Items.Clear();
              columnCollationComboBox.Items.Add("Table Default");

              foreach (String coll in collations_list)
              {
            optCollation.Items.Add(coll);
            columnCollationComboBox.Items.Add(coll);
              }

              // This validation was added to avoid removing the page if not needed
              // as it causes flickering
              if (mainTabControl.TabPages.Contains(insertsTabPage))
              {
            if (IsEditingLiveObject)
              mainTabControl.TabPages.Remove(insertsTabPage);
              }
              else
              {
            if (!IsEditingLiveObject)
              mainTabControl.TabPages.Add(insertsTabPage);
              }

              // We always have to remove the priv tab because the owning form + backend are recreated.
              // This means we only need to add it here if we are not editing a live object.
              // Note: we cannot reuse the priv tab page because its owning form + backend are gone
              //       when re-initializing the table editor for a new object.
              if (!IsEditingLiveObject)
              {
            mainTabControl.TabPages.Add(dbObjectEditorPages.PrivilegesTabPage);
            if (privPageWasActive)
              mainTabControl.SelectedTab = dbObjectEditorPages.PrivilegesTabPage;
              }

              // Partitioning stuff
              if (partitionTreeView.Model != null && partitionTreeView.Model is SimpleGrtTreeModel)
            (partitionTreeView.Model as SimpleGrtTreeModel).DetachEvents();

              partitionTreeBE = tableEditorBE.get_partitions();
              partitionTreeModel = new SimpleGrtTreeModel(partitionTreeView, partitionTreeBE, partNodeStateIcon, false);
              partitionTreeModel.AddColumn(partNameNodeControl, (int)MySQLTablePartitionTreeWrapper.Columns.Name, true);
              partitionTreeModel.AddColumn(partValuesNodeControl, (int)MySQLTablePartitionTreeWrapper.Columns.Value, true);
              partitionTreeModel.AddColumn(partDataDirNodeControl, (int)MySQLTablePartitionTreeWrapper.Columns.DataDirectory, true);
              partitionTreeModel.AddColumn(partIndexDirNodeControl, (int)MySQLTablePartitionTreeWrapper.Columns.IndexDirectory, true);
              partitionTreeModel.AddColumn(partMaxRowsNodeControl, (int)MySQLTablePartitionTreeWrapper.Columns.MaxRows, true);
              partitionTreeModel.AddColumn(partMinRowsNodeControl, (int)MySQLTablePartitionTreeWrapper.Columns.MinRows, true);
              partitionTreeModel.AddColumn(partCommentNodeControl, (int)MySQLTablePartitionTreeWrapper.Columns.Comment, true);
              partitionTreeView.Model = partitionTreeModel;
              partitionTreeView.Refresh();

              tableEditorBE.load_trigger_sql();
        }
        public override bool ReinitWithArguments(GrtValue value)
        {
            InitializingControls = true;

              try
              {
            Backend = new RoleEditorBE(GrtManager, value);

            // (Re) Initialize backend.
            roleTreeBE = RoleEditorBackend.get_role_tree();
            roleTreeBE.refresh();

            roleObjectListWrapper = RoleEditorBackend.get_object_list();
            roleObjectListWrapper.refresh();
            rolePrivilegeListWrapper = RoleEditorBackend.get_privilege_list();
            rolePrivilegeListWrapper.refresh();

            if (roleTreeModel != null)
              roleTreeModel.DetachEvents();
            roleTreeModel = new SimpleGrtTreeModel(rolesTreeView, roleTreeBE, false);
            roleTreeModel.AddColumn(roleNameNodeControl, (int)RoleTreeBE.Columns.Name, false);
            rolesTreeView.Model = roleTreeModel;

            if (roleObjectListModel != null)
              roleObjectListModel.DetachEvents();
            roleObjectListModel = new SimpleGrtListModel(roleObjectsTreeView, roleObjectListWrapper, objectIconNodeControl, false);
            roleObjectListModel.AddColumn(objectNameNodeControl, (int)RoleObjectListWrapper.Columns.Name, false);
            roleObjectsTreeView.Model = roleObjectListModel;

            RefreshFormData();
              }
              finally
              {
            InitializingControls = false;
              }

              Invalidate();

              return true;
        }