public void CreateNewObject() { if (m_conn.DatabaseCaps.ExecuteSql) { OpenQueryParameters pars = new OpenQueryParameters(); IPhysicalConnection newconn = GetConnection().Clone(); string dbname = TreeNodeExtension.GetDatabaseName(this); if (dbname != null) { newconn.AfterOpen += ConnTools.ChangeDatabaseCallback(dbname); } pars.GenerateSql = delegate(IPhysicalConnection conn) { return(m_dbtype.GenerateCreateNew(conn.SystemConnection, TreeNodeExtension.GetAnyObjectPath(this))); }; pars.HideDesign = true; pars.ExecutedCallback = this.CompleteRefresh; MainWindow.Instance.OpenContent(new QueryFrame(newconn, pars)); } else { string sql = m_dbtype.GenerateCreateNew(m_conn.Connection.SystemConnection, TreeNodeExtension.GetAnyObjectPath(this)); var pars = new ObjectEditorPars { SavedCallback = this.CompleteRefresh }; var frm = new SpecificObjectFrame(m_conn, m_repr.ObjectType, sql, pars); MainWindow.Instance.OpenContent(frm); } }
private void tree_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) { try { if (e.Node is DATreeNode) { DATreeNode ada = (DATreeNode)e.Node; if (e.Label == null) { ada.Text = ada.m_node.Title; return; } string newname = e.Label; e.CancelEdit = true;// revert to old name ada.Text = ada.m_node.Title; MacroManager.RenameNode(ada.m_node, newname); ada.m_node.RenameNode(newname); TreeNodeExtension.CompleteRefresh(ada.m_node.Parent); } } catch (Exception ex) { Errors.Report(ex); } }
public void EditConnection() { if (m_stored != null) { var stored2 = m_stored.CloneUsingXml(); if (stored2.Edit()) { stored2.Save(); RealNode.KillNode(); TreeNodeExtension.CompleteRefresh(Parent); //m_conn = m_stored.Connect(m_filepath); //m_conn.HasOwner = true; } } }
public void MenuCreateDatabase() { var dbprops = new DatabaseProperties(); dbprops.Name = "newdb"; if (DatabasePropertiesForm.Run(dbprops, new GenericDatabaseSource(m_conn, m_conn.Connection, null), false)) { if (ArrayTool.Contains(m_conn.Databases, dbprops.Name)) { StdDialog.ShowError(Texts.Get("s_database_allready_exists")); return; } InvokeScript(fmt => { fmt.CreateDatabase(dbprops.Name, dbprops.SpecificData); }); TreeNodeExtension.CompleteRefresh(this); } }
public bool Delete() { if (!AllowDelete()) { return(false); } if (!DoDelete()) { return(false); } TreeNodeExtension.CompleteRefresh(Parent); if (RealNode.TreeBehaviour.AfterDeletedNode != null) { RealNode.TreeBehaviour.AfterDeletedNode(this); } return(true); }
public static ITreeNode[] GetChildren(IDatabaseSource dbconn, ITreeNode parent, string dbname) { List <ITreeNode> res = new List <ITreeNode>(); if (!dbconn.DatabaseCaps.IsPhantom) { res.Add(new Tables_TreeNode(dbconn, parent, false)); if (dbconn.DatabaseCaps.MultipleSchema) { res.Add(new Schemas_TreeNode(dbconn, parent)); } if (dbconn.DatabaseCaps.Domains) { res.Add(new Domains_TreeNode(dbconn, parent)); } } parent.GetDbObjectNodes(dbconn, res, DbObjectParent.Database, new ObjectPath(dbname), false); if (dbconn.DatabaseCaps.IsPhantom) { if (LicenseTool.FeatureAllowed(DatabaseBackupFeature.Test)) { res.Add(new Backups_TreeNode(dbconn, parent)); } } else { if (dbconn.IsFullAvailable()) { res.Add(new SystemDbObjectsNode(dbconn, parent, dbname)); if (LicenseTool.FeatureAllowed(DatabaseBackupFeature.Test) && dbconn.GetAnyDialect().DialectCaps.SupportBackup) { res.Add(new Backups_TreeNode(dbconn, parent)); } } } if (dbconn.GetPrivateSubFolder("sqlscripts") != null) { TreeNodeExtension.AddFolderNodes(res, "sqlscripts", (folder, postfix, namePostfix) => new SqlScripts_TreeNode(dbconn, folder, parent, postfix, namePostfix), dbconn); } return(res.ToArray()); }
public virtual string GetDataTreeName() { return(TreeNodeExtension.FileNameToDataTreeName(GetFileName())); }
public override ObjectPath GetObjectPath() { return(new ObjectPath(TreeNodeExtension.GetDatabaseName(this), m_constraint.Table.FullName, m_constraint.Name)); }
public override ObjectPath GetObjectPath() { return(new ObjectPath(TreeNodeExtension.GetDatabaseName(this), m_tblname)); }
private void UpdateTabs() { if (!IsContentVisible || m_suspendedDashboard) { return; } //tabControl1.TabPages.Clear(); try { m_updatingTabs = true; tabControl1.Enabled = false; var widgets = TreeNodeExtension.GetAllWidgets(m_selectedObject); int pgindex = 0; foreach (IWidget widget in widgets) { TabPage pg = FindPage(widget, pgindex); if (pg != null) { if (tabControl1.TabPages.IndexOf(pg) != pgindex) { int origindex = tabControl1.TabPages.IndexOf(pg); tabControl1.TabPages.RemoveAt(origindex); tabControl1.TabPages.Insert(pgindex, pg); List <PageRecord> tmp = new List <PageRecord>(m_loadedPages); PageRecord orig = tmp[origindex]; tmp[pgindex].Dispose(); tmp.RemoveAt(origindex); tmp.Insert(pgindex, orig); m_loadedPages = tmp.ToArray(); } m_loadedPages[pgindex].isloaded = false; m_loadedPages[pgindex].ReplaceWidget(widget); pg.Text = Texts.Get(widget.PageTitle); pg.ImageIndex = m_imgCache.GetImageIndex(widget.Image); } else { List <PageRecord> tmp = new List <PageRecord>(m_loadedPages); PageRecord newrec = new PageRecord(); newrec.widget = widget; tabControl1.TabPages.Insert(pgindex, Texts.Get(widget.PageTitle)); tabControl1.TabPages[pgindex].ImageIndex = m_imgCache.GetImageIndex(widget.Image); tmp.Insert(pgindex, newrec); m_loadedPages = tmp.ToArray(); } pgindex++; } try { while (tabControl1.TabPages.Count > widgets.Count) { tabControl1.SelectedIndex = 0; tabControl1.TabPages.RemoveAt(widgets.Count); } List <PageRecord> tmp = new List <PageRecord>(m_loadedPages); for (int i = widgets.Count; i < tmp.Count; i++) { tmp[i].Dispose(); } tmp.RemoveRange(widgets.Count, tmp.Count - widgets.Count); m_loadedPages = tmp.ToArray(); } catch (Exception) { tabControl1.TabPages.Clear(); foreach (PageRecord pgrec in m_loadedPages) { pgrec.Dispose(); } m_loadedPages = new PageRecord[] { }; UpdateTabs(); } } finally { m_updatingTabs = false; tabControl1.Enabled = true; } LoadCurPage(); }