public void SetCollection(IActivateItems activator, IPersistableObjectCollection collection) { _collection = (IViewSQLAndResultsCollection)collection; CommonFunctionality.ClearToolStrip(); btnExecuteSql.Image = activator.CoreIconProvider.GetImage(RDMPConcept.SQL, OverlayKind.Execute); var overlayer = new IconOverlayProvider(); btnResetSql.Image = overlayer.GetOverlay(FamFamFamIcons.text_align_left, OverlayKind.Problem); if (_autoComplete == null) { _autoComplete = new AutoCompleteProviderFactory(activator).Create(_collection.GetQuerySyntaxHelper()); _collection.AdjustAutocomplete(_autoComplete); _autoComplete.RegisterForEvents(_scintilla); } SetItemActivator(activator); CommonFunctionality.Add(btnExecuteSql); CommonFunctionality.Add(btnResetSql); foreach (var c in _timeoutControls.GetControls()) { CommonFunctionality.Add(c); } foreach (DatabaseEntity d in _collection.GetToolStripObjects()) { CommonFunctionality.AddToMenu(new ExecuteCommandShow(activator, d, 0, true)); } CommonFunctionality.Add(new ToolStripSeparator()); CommonFunctionality.Add(_serverHeader); try { var dap = _collection.GetDataAccessPoint(); _serverHeader.Text = $"Server: {dap.Server} Database: {dap.Database}"; _serverHeader.Image = _databaseTypeIconProvider.GetImage(dap.DatabaseType); } catch (Exception) { _serverHeader.Text = "Server:Unknown"; } RefreshUIFromDatabase(); }
public void SetCollection(IActivateItems activator, IPersistableObjectCollection collection) { _collection = (IViewSQLAndResultsCollection)collection; CommonFunctionality.ClearToolStrip(); btnExecuteSql.Image = activator.CoreIconProvider.GetImage(RDMPConcept.SQL, OverlayKind.Execute); var overlayer = new IconOverlayProvider(); btnResetSql.Image = overlayer.GetOverlay(FamFamFamIcons.text_align_left, OverlayKind.Problem); if (_scintilla == null) { // figure out what DBMS we are targetting var syntax = _collection.GetQuerySyntaxHelper(); // Create the SQL editor for that language ScintillaTextEditorFactory factory = new ScintillaTextEditorFactory(); _scintilla = factory.Create(null, SyntaxLanguage.SQL, syntax); splitContainer1.Panel1.Controls.Add(_scintilla); _scintilla.TextChanged += _scintilla_TextChanged; _scintilla.KeyUp += ScintillaOnKeyUp; // Setup autocomplete menu for the DBMS language _autoComplete = new AutoCompleteProviderWin(syntax); _collection.AdjustAutocomplete(_autoComplete); _autoComplete.RegisterForEvents(_scintilla); } SetItemActivator(activator); CommonFunctionality.Add(btnExecuteSql); CommonFunctionality.Add(btnResetSql); foreach (var c in _timeoutControls.GetControls()) { CommonFunctionality.Add(c); } foreach (DatabaseEntity d in _collection.GetToolStripObjects()) { CommonFunctionality.AddToMenu(new ExecuteCommandShow(activator, d, 0, true)); } CommonFunctionality.Add(new ToolStripSeparator()); CommonFunctionality.Add(_serverHeader); try { var dap = _collection.GetDataAccessPoint(); _serverHeader.Text = $"Server: {dap.Server} Database: {dap.Database}"; _serverHeader.Image = _databaseTypeIconProvider.GetImage(dap.DatabaseType); } catch (Exception) { _serverHeader.Text = "Server:Unknown"; } RefreshUIFromDatabase(); }