void OnViewSelected(object o, ViewSelectedEventArgs args) { ViewPlugin vp = Global.Plugins.GetViewPlugin(args.Name, args.ConnectionName); Connection conn = null; if (vp == null) { if (viewDataTreeView != null) { viewDataTreeView.Destroy(); viewDataTreeView = null; } if (serverInfoView != null) { serverInfoView.Destroy(); serverInfoView = null; } conn = Global.Connections [args.ConnectionName]; serverInfoView = new ServerInfoView(conn); valuesScrolledWindow.AddWithViewport(serverInfoView); valuesScrolledWindow.ShowAll(); ToggleButtons(false); UpdateStatusBar(); return; } CleanupView(); if (viewDataTreeView == null) { if (serverInfoView != null) { serverInfoView.Destroy(); serverInfoView = null; } conn = Global.Connections [args.ConnectionName]; viewDataTreeView = new ViewDataTreeView(conn, mainWindow); valuesScrolledWindow.AddWithViewport(viewDataTreeView); valuesScrolledWindow.ShowAll(); } viewDataTreeView.ConfigureView(vp); viewDataTreeView.Populate(); SetupToolbar(vp); GenerateNewMenu(conn); UpdateStatusBar(); }
void CleanupView() { if (viewDataTreeView != null) { newMenuToolButton.Clicked -= new EventHandler(viewDataTreeView.OnNewEntryActivate); propertiesToolButton.Clicked -= new EventHandler(viewDataTreeView.OnEditActivate); deleteToolButton.Clicked -= new EventHandler(viewDataTreeView.OnDeleteActivate); refreshToolButton.Clicked -= new EventHandler(viewDataTreeView.OnRefreshActivate); viewDataTreeView.Destroy(); viewDataTreeView = null; } }
void OnNotebookViewChanged(object o, SwitchPageArgs args) { WriteStatusMessage(""); if (args.PageNum == 0) { ldapTreeView.removeToolbarHandlers(); ToggleButtons(false); ToggleInfoNotebook(false); viewsView.Active = true; if (serverInfoView != null) { serverInfoView.Destroy(); serverInfoView = null; } if (attributeEditor != null) { attributeEditor.Destroy(); attributeEditor = null; } templateToolButton.Hide(); } else if (args.PageNum == 1) { CleanupView(); ToggleButtons(true); ToggleInfoNotebook(false); browserView.Active = true; newMenuItem.Submenu = null; newMenuToolButton.Menu = null; templateToolButton.Show(); propertiesToolButton.Hide(); refreshToolButton.Hide(); if (serverInfoView != null) { serverInfoView.Destroy(); serverInfoView = null; } if (viewDataTreeView != null) { viewDataTreeView.Destroy(); viewDataTreeView = null; } if (attributeEditor == null) { attributeEditor = new AttributeEditorWidget(); valuesScrolledWindow.AddWithViewport(attributeEditor); valuesScrolledWindow.Show(); } ldapTreeView.setToolbarHandlers(newMenuToolButton, deleteToolButton); SetBrowserTooltips(); } else if (args.PageNum == 2) { CleanupView(); ldapTreeView.removeToolbarHandlers(); searchView.Active = true; newMenuItem.Submenu = null; newMenuToolButton.Menu = null; if (serverInfoView != null) { serverInfoView.Destroy(); serverInfoView = null; } if (viewDataTreeView != null) { viewDataTreeView.Destroy(); viewDataTreeView = null; } if (attributeEditor == null) { attributeEditor = new AttributeEditorWidget(); valuesScrolledWindow.AddWithViewport(attributeEditor); valuesScrolledWindow.Show(); } ToggleButtons(false); ToggleInfoNotebook(false); templateToolButton.Hide(); if (serverComboBox != null) { serverComboBox.Destroy(); serverComboBox = null; } CreateServerCombo(); } else if (args.PageNum == 3) { CleanupView(); ToggleButtons(false); schemaView.Active = true; newMenuItem.Submenu = null; newMenuToolButton.Menu = null; ToggleInfoNotebook(true); SetInfoNotePage(-1); templateToolButton.Hide(); } }