From f800a6be9e7ec9583d75294c4d3656f6dbeb1272 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 7 Nov 2009 20:36:55 +0000 Subject: [PATCH] Remove old SharpServerTools (got replaced by ICSharpCode.Data) git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5229 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Configuration/AssemblyInfo.cs | 15 - .../DataTools.Model/DataTools.Model.csproj | 63 ---- .../DataTools.Model/Src/ColumnNames.cs | 22 -- .../DataTools.Model/Src/DbModelInfo.cs | 170 ---------- .../DataTools.Model/Src/DbModelInfoService.cs | 301 ----------------- .../Src/DbProvidersException.cs | 40 --- .../DataTools.Model/Src/DbProvidersService.cs | 132 -------- .../DataTools.Model/Src/MetadataNames.cs | 22 -- .../Configuration/AssemblyInfo.cs | 15 - .../DataTools.UI/DataTools.UI.csproj | 65 ---- .../DataTools.UI/Resources/Strings.resx | 205 ------------ ...nnectionStringDefinitionDialog.Designer.cs | 236 -------------- .../Src/ConnectionStringDefinitionDialog.cs | 286 ---------------- .../Src/ConnectionStringDefinitionDialog.resx | 126 -------- .../ServerBrowserTool/Resources/Strings.resx | 120 ------- .../ServerBrowserTool.csproj | 75 ----- .../ServerBrowserTool/ServerBrowserTool.sln | 6 - .../ServerBrowserTool/SharpServerTools.addin | 48 --- .../Src/Configuration/AssemblyInfo.cs | 21 -- .../Src/Forms/IInitializable.cs | 19 -- .../Src/Forms/ISupportsDragDrop.cs | 23 -- .../Src/Forms/NodeAwareContextMenuStrip.cs | 28 -- .../Src/Forms/ProgressEllipsis.cs | 56 ---- .../Src/Forms/RebuildRequiredEvents.cs | 54 ---- .../Src/Forms/ServerBrowserTool.cs | 64 ---- .../Src/Forms/ServerToolTreeView.cs | 108 ------- .../SharpDbTools/DataTools.AddIn.csproj | 109 ------- .../SharpDbTools/Resources/SQL.xshd | 159 --------- .../SharpDbTools/Resources/Strings.resx | 205 ------------ .../SharpDbTools/Resources/SyntaxModes.xml | 5 - .../SharpDbTools/SharpDbTools.sln | 6 - .../Src/Configuration/AssemblyInfo.cs | 20 -- .../Forms.TextEditor/SQLTextEditorControl.cs | 109 ------- .../Src/Forms/DatabaseExplorerTreeNode.cs | 186 ----------- .../Src/Forms/DbModelInfoTreeNode.cs | 305 ------------------ .../Src/Forms/FormsArtefactFactories.cs | 52 --- .../Src/Forms/FormsArtefactFactory.cs | 32 -- .../Src/Forms/SQLTool.Designer.cs | 167 ---------- .../SharpDbTools/Src/Forms/SQLTool.cs | 215 ------------ .../SharpDbTools/Src/Forms/SQLTool.resx | 126 -------- .../SQLToolResourceSyntaxModeProvider.cs | 54 ---- .../Src/Forms/SQLToolViewContent.cs | 49 --- .../Src/Forms/TableDescribeViewContent.cs | 72 ----- .../SharpDbTools/Src/Forms/TableTreeNode.cs | 62 ---- .../Provider/OracleFormsArtefactFactory.cs | 107 ------ .../Provider/SQLServerFormsArtefactFactory.cs | 123 ------- .../Src/Provider/SQLiteArtefactFactory.cs | 98 ------ .../SharpServerTools/SharpServerTools.addin | 24 -- 48 files changed, 4605 deletions(-) delete mode 100644 src/AddIns/Misc/SharpServerTools/DataTools.Model/Configuration/AssemblyInfo.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/DataTools.Model/DataTools.Model.csproj delete mode 100644 src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/ColumnNames.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbModelInfo.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbModelInfoService.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbProvidersException.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbProvidersService.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/MetadataNames.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/DataTools.UI/Configuration/AssemblyInfo.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/DataTools.UI/DataTools.UI.csproj delete mode 100644 src/AddIns/Misc/SharpServerTools/DataTools.UI/Resources/Strings.resx delete mode 100644 src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.Designer.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.resx delete mode 100644 src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Resources/Strings.resx delete mode 100644 src/AddIns/Misc/SharpServerTools/ServerBrowserTool/ServerBrowserTool.csproj delete mode 100644 src/AddIns/Misc/SharpServerTools/ServerBrowserTool/ServerBrowserTool.sln delete mode 100644 src/AddIns/Misc/SharpServerTools/ServerBrowserTool/SharpServerTools.addin delete mode 100644 src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Configuration/AssemblyInfo.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/IInitializable.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ISupportsDragDrop.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/NodeAwareContextMenuStrip.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ProgressEllipsis.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/RebuildRequiredEvents.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ServerBrowserTool.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ServerToolTreeView.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/DataTools.AddIn.csproj delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/SQL.xshd delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/Strings.resx delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/SyntaxModes.xml delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/SharpDbTools.sln delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Configuration/AssemblyInfo.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms.TextEditor/SQLTextEditorControl.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/DatabaseExplorerTreeNode.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/DbModelInfoTreeNode.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/FormsArtefactFactories.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/FormsArtefactFactory.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.Designer.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.resx delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLToolResourceSyntaxModeProvider.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLToolViewContent.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/TableDescribeViewContent.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/TableTreeNode.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Provider/OracleFormsArtefactFactory.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Provider/SQLServerFormsArtefactFactory.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Provider/SQLiteArtefactFactory.cs delete mode 100644 src/AddIns/Misc/SharpServerTools/SharpServerTools.addin diff --git a/src/AddIns/Misc/SharpServerTools/DataTools.Model/Configuration/AssemblyInfo.cs b/src/AddIns/Misc/SharpServerTools/DataTools.Model/Configuration/AssemblyInfo.cs deleted file mode 100644 index dd8ba0bd23..0000000000 --- a/src/AddIns/Misc/SharpServerTools/DataTools.Model/Configuration/AssemblyInfo.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("DataTools.Model")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] diff --git a/src/AddIns/Misc/SharpServerTools/DataTools.Model/DataTools.Model.csproj b/src/AddIns/Misc/SharpServerTools/DataTools.Model/DataTools.Model.csproj deleted file mode 100644 index fef1c7f9ba..0000000000 --- a/src/AddIns/Misc/SharpServerTools/DataTools.Model/DataTools.Model.csproj +++ /dev/null @@ -1,63 +0,0 @@ - - - {51783FC4-D8D2-4BFB-A1F1-AC8857CF3ED0} - Debug - AnyCPU - Library - ICSharpCode.DataTools.Model - ICSharpCode.DataTools.Model - False - False - 4 - false - - - ..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\ - true - Full - True - DEBUG;TRACE - False - - - ..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\ - False - None - False - TRACE - - - False - Auto - 4194304 - AnyCPU - 4096 - - - - - ..\..\..\..\Libraries\log4net\log4net.dll - False - - - - - - - - Configuration\GlobalAssemblyInfo.cs - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/ColumnNames.cs b/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/ColumnNames.cs deleted file mode 100644 index 27e51e119b..0000000000 --- a/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/ColumnNames.cs +++ /dev/null @@ -1,22 +0,0 @@ -// -// -// -// -// $Revision: 1784 $ -// - -using System; - -namespace SharpDbTools.Data -{ - /// - /// Description of Columns. - /// - public sealed class ColumnNames - { - public const string InvariantName = "invariantName"; - public const string Name = "name"; - public const string ConnectionString = "connectionString"; - public const string TableName = "TABLE_NAME"; - } -} diff --git a/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbModelInfo.cs b/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbModelInfo.cs deleted file mode 100644 index 081bee4a7d..0000000000 --- a/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbModelInfo.cs +++ /dev/null @@ -1,170 +0,0 @@ -// -// -// -// -// $Revision: 1784 $ -// - -using System; -using System.Data; - -namespace SharpDbTools.Data -{ - /// - /// DbModel is a DataSet containing the metadata tables returned from a DbConnection. - /// It adds methods designed specifically to facilitate access to the data in the - /// DataTables contained by the DbModel. - /// - /// The DbModel class is intended to be usable in a fully disconnected mode - that is, - /// it requires a DbConnection to populate it, but it may then be locally persisted and subsequently - /// retrieved from its persisted data. This is intended to allow work to progress against the - /// DbModel without requiring a connection to its RDB server. - /// - /// - public class DbModelInfo: DataSet - { - public const string METADATACOLLECTIONS = "MetaDataCollections"; - - public DbModelInfo() : base() - { - } - - public DbModelInfo(string name) : base() - { - DataTable table = CreateConnectionInfoTable(); - // add the first and only column of this table; - table.Rows.Add(new object[] {name, null, null}); - } - - public DbModelInfo(string name, string invariantName, string connectionString): base() - { - DataTable table = CreateConnectionInfoTable(); - // add the first and only column of this table; - table.Rows.Add(new object[] {name, invariantName, connectionString}); - } - - public string Name { - get { - DataTable table = this.Tables[MetadataNames.ConnectionInfo]; - string name = table.Rows[0][ColumnNames.Name] as string; - return name; - } - } - - public string InvariantName { - get { - DataTable table = this.Tables[MetadataNames.ConnectionInfo]; - string invariantName = null; - try { - invariantName = table.Rows[0][ColumnNames.InvariantName] as string; - } - catch(ArgumentException) { - // see comment below - it is correct to bury this exception - //LoggingService.Info("InvariantName property was accessed while undefined" + e); - } - return invariantName; - } - set { - DataTable table = this.Tables[MetadataNames.ConnectionInfo]; - string invariantName = table.Rows[0][ColumnNames.InvariantName] as string; - string name = this.Name; - string connectionString = this.ConnectionString; - - if (invariantName == null) { - table.Rows[0][ColumnNames.InvariantName] = value; - } - - // if invariant has changed must clear any existing metadata - else if (!(invariantName.Equals(value))) { - // clear tables - this.Clear(); - DataTable newTable = CreateConnectionInfoTable(); - // add the first and only column of this table; - newTable.Rows.Add(new object[] {name, invariantName, connectionString}); - } - } - } - - public string ConnectionString { - get { - DataTable table = this.Tables[MetadataNames.ConnectionInfo]; - string connectionString = null; - try { - connectionString = table.Rows[0][ColumnNames.ConnectionString] as string; - } - catch(ArgumentException) { - // this simply indicates that this attribute was not defined when the - // DbModelInfo was saved, returning null makes sense here - so it is - // correct to bury this exception - //LoggingService.Info("InvariantName property was accessed while undefined" + e); - } - return connectionString; - } - set { - DataTable table = this.Tables[MetadataNames.ConnectionInfo]; - string connectionString = this.ConnectionString; - if (connectionString == null) { - table.Rows[0][ColumnNames.ConnectionString] = value; - } - else if (!(connectionString.Equals(value))) { - string invariantName = this.InvariantName; - string name = this.Name; - this.Clear(); - // add the first and only column of this table; - table.Rows.Add(new object[] {name, invariantName, value}); - } - } - } - - public void SetConnectionInfo(string invariantName, string connectionString) - { - string name = this.Name; - SetConnectionInfo(name, invariantName, connectionString); - } - - public void SetConnectionInfo(string name, string invariantName, - string connectionString) - { - this.Clear(); - DataTable table = CreateConnectionInfoTable(); - // add the first and only column of this table; - table.Rows.Add(new object[] {name, invariantName, connectionString}); - - } - - private DataTable CreateConnectionInfoTable() - { - // create a table in the DbModelInfo to hold this initial info. - // this creates a consistent representation of the data and makes - // it easier to serialise it - DataTable table = this.Tables.Add(MetadataNames.ConnectionInfo); - table.Columns.Add(ColumnNames.Name, typeof(string)); - table.Columns.Add(ColumnNames.InvariantName, typeof(string)); - table.Columns.Add(ColumnNames.ConnectionString, typeof(string)); - return table; - } - - public void ClearMetaData() - { - DataTable metadataCollectionsTable = this.MetaDataCollections; - if (metadataCollectionsTable != null) { - foreach (DataRow collectionRow in metadataCollectionsTable.Rows) { - String collectionName = (string)collectionRow[0]; - this.Tables.Remove(collectionName); - } - } - } - - public DataTable MetaDataCollections { - get { - return this.Tables[METADATACOLLECTIONS]; - } - } - - public DataTable this[string collectionName] { - get { - return this.Tables[collectionName]; - } - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbModelInfoService.cs b/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbModelInfoService.cs deleted file mode 100644 index 17c708b6f3..0000000000 --- a/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbModelInfoService.cs +++ /dev/null @@ -1,301 +0,0 @@ -// -// -// -// -// $Revision: 1784 $ -// - -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Common; -using System.IO; - -using log4net; - -namespace SharpDbTools.Data -{ - /// - /// Manages a collection of DbModelInfo: - /// - retrieval from files - /// - opening (essentially refreshing) from a database connection - /// - adding for new connection data (name, invariant name, connection string) - /// - saving to files - /// Note: it is not threadsafe - /// - public static class DbModelInfoService - { - const string dbFilesDir = "DbTools"; - static SortedList cache = null; - static ILog log = LogManager.GetLogger(typeof(DbModelInfoService)); - static string savePath; - - - public static string SavePath { - set { - savePath = value; - } - get { - return savePath; - } - } - public static IList Names { - get { - if (cache == null) { - cache = new SortedList(); - LoadNamesFromFiles(); - } - return cache.Keys; - } - } - - /// - /// - /// - /// The user readable name of the provider - /// the identifying name of the provider - /// the connection string for this connection - /// - public static DbModelInfo Add(string name, string invariantName, string connectionString) - { - // TODO: add validation on name; invariant name - // assume that connection string is valid - if it fails an exception will be thrown later - // this allows partially defined connection strings at least to be saved and worked on later - DbModelInfo dbModel = new DbModelInfo(name, invariantName, connectionString); - - // add to cache - cache.Add(name, dbModel); - return dbModel; - } - - public static void Remove(string name) - { - cache.Remove(name); - } - - public static DbModelInfo GetDbModelInfo(string name) { - DbModelInfo modelInfo = null; - bool exists = cache.TryGetValue(name, out modelInfo); - return modelInfo; - } - - public static DataTable GetTableInfo(string modelName, string tableName) - { - log.Debug("-->GetTableInfo"); - DbModelInfo modelInfo = GetDbModelInfo(modelName); - DataTable columnTable = modelInfo.Tables[MetadataNames.Columns]; - DataRow[] columnsMetadata = columnTable.Select(ColumnNames.TableName + "='" + tableName + "'"); - log.Debug("found: " + columnsMetadata.Length + " columns belonging to table: " + tableName); - DataTable tableInfo = new DataTable(); - DataColumnCollection cols = columnTable.Columns; - foreach (DataColumn c in cols) { - DataColumn nc = new DataColumn(c.ColumnName, c.DataType); - tableInfo.Columns.Add(nc); - } - foreach (DataRow r in columnsMetadata) { - DataRow newRow = tableInfo.NewRow(); - newRow.ItemArray = r.ItemArray; - tableInfo.Rows.Add(newRow); - tableInfo.AcceptChanges(); - } - return tableInfo; - - } - - public static DbModelInfo LoadMetadataFromConnection(string name) - { - // get the DbModelInfo - - DbModelInfo modelInfo = null; - bool exists = cache.TryGetValue(name, out modelInfo); - if (!exists) - { - // TODO: more detail... - throw new KeyNotFoundException(); - } - - // get the invariant name and connection string - - string invariantName = modelInfo.InvariantName; - string connectionString = modelInfo.ConnectionString; - - // get a connection - wait until a connection has been successfully made - // before clearing the DbModelInfo - - DbProvidersService factoryService = DbProvidersService.GetDbProvidersService(); - DbConnection connection = null; - try { - - DbProviderFactory factory = factoryService.GetFactoryByInvariantName(invariantName); - connection = factory.CreateConnection(); - - - modelInfo.ClearMetaData(); - - // reload the metadata from the connection - // get the Schema table - connection.ConnectionString = connectionString; - - connection.Open(); - DataTable schemaInfo = connection.GetSchema(); - if (schemaInfo != null) { - log.Debug("retrieved schema info with " + schemaInfo.Rows.Count + " rows"); - } - - // clear the DbModelInfo prior to refreshing from the connection - modelInfo.ClearMetaData(); - - // iterate through the rows in it - the first column of each is a - // schema info collection name that can be retrieved as a DbTable - // Add each one to the DbModel DataSet - - foreach (DataRow collectionRow in schemaInfo.Rows) { - String collectionName = (string)collectionRow[0]; - log.Debug("loading metadata for collection: " + collectionName); - DataTable nextMetaData = connection.GetSchema(collectionName); - modelInfo.Merge(nextMetaData); - } - log.Debug("completed load of metadata, committing changes"); - modelInfo.AcceptChanges(); - return modelInfo; - } - catch(Exception e) { - log.Fatal("Exception caught while trying to retrieve database metadata: " + e); - throw e; - } - finally { - connection.Close(); - } - } - - /// - /// - /// - /// the logical name of the DbModelInfo to save to a file - /// if true, any existing file will be overwritten - /// true if the DbModelInfo was saved, false if not. It will not be saved if - /// either overwriteExistingFile is set to true, and there is an existing file - public static bool SaveToFile(string name, bool overwriteExistingFile) - { - string path = GetSaveLocation(); - DbModelInfo modelInfo = null; - cache.TryGetValue(name, out modelInfo); - if (modelInfo != null) { - string modelName = modelInfo.Name; - // write to a file in 'path' called .metadata - // TODO: may want to consider ways of making this more resilient - - string connectionProps = modelInfo.ConnectionString; - string invariantName = modelInfo.InvariantName; - - - - string filePath = path + @"\" + name + ".metadata"; - log.Debug("writing metadata to: " + filePath); - if (File.Exists(filePath)) { - if (overwriteExistingFile) { - File.Delete(filePath); - } else { - return false; - } - } - using (StreamWriter sw = File.CreateText(filePath)) { - string xml = modelInfo.GetXml(); - sw.Write(xml); - sw.Flush(); - sw.Close(); - return true; - } - } else { - throw new DbModelInfoDoesNotExistException(name); - } - } - - public static void SaveAll() - { - foreach (string name in cache.Keys) { - SaveToFile(name, true); - } - } - - public static void LoadNamesFromFiles() - { - // load DbModelInfo's from file system - string saveLocation = GetSaveLocation(); - log.Debug("looking for metadata files at: " + saveLocation); - string[] files = Directory.GetFileSystemEntries(saveLocation); - - cache.Clear(); - for (int i = 0; i < files.Length; i++) { - log.Debug("found to load metadata from: " + files[i]); - int start = files[i].LastIndexOf('\\'); - int end = files[i].LastIndexOf('.'); - start++; - string name = files[i].Substring(start, end - start); - DbModelInfo nextModel = new DbModelInfo(name); - cache.Add(nextModel.Name, nextModel); - } - } - - public static void LoadFromFiles() - { - // load DbModelInfo's from file system - string saveLocation = GetSaveLocation(); - string[] files = Directory.GetFiles(saveLocation); - cache.Clear(); - for (int i = 0; i < files.Length; i++) { - DbModelInfo nextModel = LoadFromFileAtPath(@files[i]); - cache.Add(nextModel.Name, nextModel); - } - } - - private static DbModelInfo LoadFromFileAtPath(string filePath) - { - log.Debug("loading DbModelInfo from filePath: " + filePath); - DbModelInfo nextModel = new DbModelInfo(); - nextModel.ReadXml(filePath); - return nextModel; - } - - public static void LoadFromFile(string logicalConnectionName) - { - log.Debug("loading DbModelInfo for name: " + logicalConnectionName); - string saveLocation = GetSaveLocation(); - string path = saveLocation + "\\" + logicalConnectionName + ".metadata"; - DbModelInfo info = LoadFromFileAtPath(path); - cache.Remove(logicalConnectionName); - cache.Add(logicalConnectionName, info); - } - - private static string GetSaveLocation() - { - // append the path of the directory for saving Db files - - if (SavePath == null) { - string configDir = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); - SavePath = configDir + @"\" + dbFilesDir; - SavePath = SavePath.Replace("/", @"\"); - } - if (!Directory.Exists(SavePath)) { - Directory.CreateDirectory(@SavePath); - } - return SavePath; - } - } - - public class DbModelInfoDoesNotExistException: ApplicationException - { - string name; - - public DbModelInfoDoesNotExistException(string dbModelInfoName): base() - { - this.name = dbModelInfoName; - } - - public string Name { - get { - return name; - } - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbProvidersException.cs b/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbProvidersException.cs deleted file mode 100644 index d09aa2cc09..0000000000 --- a/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbProvidersException.cs +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Created by SharpDevelop. - * User: dickon - * Date: 31/03/2007 - * Time: 15:57 - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -using System; -using System.Runtime.Serialization; -using System.Collections.Generic; - -namespace SharpDbTools.Data -{ - /// - /// Thrown when the DbProvidersService cannot find the class for - /// a DbProviderFactory that is found in a *.config file. - /// - - [Serializable()] - public class DbProvidersException : Exception - { - public DbProvidersException() : base() - { - } - - public DbProvidersException(string message) : base(message) - { - } - - public DbProvidersException(string message, Exception innerException) : base(message, innerException) - { - } - - protected DbProvidersException(SerializationInfo info, StreamingContext context) : base(info, context) - { - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbProvidersService.cs b/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbProvidersService.cs deleted file mode 100644 index 6daef837a4..0000000000 --- a/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbProvidersService.cs +++ /dev/null @@ -1,132 +0,0 @@ -// -// -// -// -// $Revision: 1697 $ -// - -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Common; - -using log4net; - -namespace SharpDbTools.Data -{ - /// - /// A utility class that caches the DbProviderFactory and DbConnectionString - /// objects whose state is stored in the current processes config space. - /// - public class DbProvidersService - { - private static DbProvidersService me = new DbProvidersService(); - private static Boolean initialized = false; - private Dictionary factories = new Dictionary(); - private Dictionary factoriesByInvariantName = new Dictionary(); - - // This is only valid witin one session - do not persist - private Dictionary invariantByNameLookup = new Dictionary(); - private List names = new List(); - static ILog log = LogManager.GetLogger(typeof(DbProvidersService)); - List errMsgs = new List(); - - private DbProvidersService() - { - } - - private void Initialize() - { - // get a complete list of config data for DbProviderFactories, indexed by name - DataTable providerFactoriesTable = DbProviderFactories.GetFactoryClasses(); - DataRow[] rows = providerFactoriesTable.Select(); - - List errorMsgs = new List(); - - foreach(DataRow row in rows) - { - // TODO: factor out string literals for column names - string name = (string)row["Name"]; - string invariantName = (string)row["InvariantName"]; - try { - log.Debug("adding lookup for: " + name + " to: + " + invariantName); - invariantByNameLookup.Add(name, invariantName); - //factoryData.Add(name, row); - - log.Debug("retrieving DbProviderFactory for Name: " - + name + " InvariantName: " + invariantName); - DbProviderFactory factory = DbProviderFactories.GetFactory(row); - names.Add(name); - factories.Add(name, factory); - factoriesByInvariantName.Add(invariantName, factory); - } catch (ArgumentException) { - errorMsgs.Add("Found duplicate config for data provider: " + name + ", invariant name: " + - invariantName + ", will use config found first"); - - } catch (Exception) { - errorMsgs.Add("Unable to load DbProviderFactory for: " + name + ", this will be unavailable." + - " Check *.config files for invalid ado.net config elements, or config"); - } - } - initialized = true; - } - - public List ErrorMessages { - get { - return this.errMsgs; - } - } - - public List Names { - get - { - return names; - } - } - - public string this[int i] - { - get - { - return names[i]; - } - } - - public string GetInvariantName(string name) { - string invariantName = null; - invariantByNameLookup.TryGetValue(name, out invariantName); - return invariantName; - } - - public DbProviderFactory this[string name] - { - get - { - return factories[name]; - } - set - { - factories[name] = value; - } - } - - public DbProviderFactory GetFactoryByInvariantName(string invariantName) - { - DbProviderFactory factory = null; - this.factoriesByInvariantName.TryGetValue(invariantName, out factory); - return factory; - } - - public static DbProvidersService GetDbProvidersService() - { - lock(me) - { - if (!initialized) - { - me.Initialize(); - } - } - return me; - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/MetadataNames.cs b/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/MetadataNames.cs deleted file mode 100644 index 29b67f8df8..0000000000 --- a/src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/MetadataNames.cs +++ /dev/null @@ -1,22 +0,0 @@ -// -// -// -// -// $Revision: 1784 $ -// - -using System; - -namespace SharpDbTools.Data -{ - /// - /// Description of Tables. - /// - public sealed class MetadataNames - { - public const string MetaDataCollections = "MetaDataCollections"; - public const string ConnectionInfo = "ConnectionInfo"; - public static string[] PrimaryObjects = new string[] { "Tables", "Procedures", "Functions", "Views", "Users" }; - public const string Columns = "Columns"; - } -} diff --git a/src/AddIns/Misc/SharpServerTools/DataTools.UI/Configuration/AssemblyInfo.cs b/src/AddIns/Misc/SharpServerTools/DataTools.UI/Configuration/AssemblyInfo.cs deleted file mode 100644 index 5baffb36d9..0000000000 --- a/src/AddIns/Misc/SharpServerTools/DataTools.UI/Configuration/AssemblyInfo.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("DataTools.UI")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] diff --git a/src/AddIns/Misc/SharpServerTools/DataTools.UI/DataTools.UI.csproj b/src/AddIns/Misc/SharpServerTools/DataTools.UI/DataTools.UI.csproj deleted file mode 100644 index 8fea3cd18c..0000000000 --- a/src/AddIns/Misc/SharpServerTools/DataTools.UI/DataTools.UI.csproj +++ /dev/null @@ -1,65 +0,0 @@ - - - {87C0E3D9-0DFD-4F6D-8E38-408AAF73F4EE} - Debug - AnyCPU - Library - ICSharpCode.DataTools.UI - ICSharpCode.DataTools.UI - False - False - 4 - false - - - ..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\ - true - Full - True - DEBUG;TRACE - False - - - ..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\ - False - None - False - TRACE - - - False - Auto - 4194304 - AnyCPU - 4096 - - - - - - - - - - - - Configuration\GlobalAssemblyInfo.cs - - - - - - - ConnectionStringDefinitionDialog.cs - - - - - - - - {51783FC4-D8D2-4BFB-A1F1-AC8857CF3ED0} - DataTools.Model - - - \ No newline at end of file diff --git a/src/AddIns/Misc/SharpServerTools/DataTools.UI/Resources/Strings.resx b/src/AddIns/Misc/SharpServerTools/DataTools.UI/Resources/Strings.resx deleted file mode 100644 index aa4fa3cc74..0000000000 --- a/src/AddIns/Misc/SharpServerTools/DataTools.UI/Resources/Strings.resx +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tables - - - Procedures - - - Functions - - - - Views - - - Users - - - Db Objects - - - Database Explorer - - - Add Connection - - - Delete Connection - - - Save All - - - Connection Properties - - - No Metadata - - - Set Connection String - - - Load Metadata From Connection - - - Load Metadata From File - - - Open SQL Tool - - - Connection String: - - - Invariant Name: - - - Connection Succeeded - - - Connection Failed - - - Test - - - Submit - - - Cancel - - - Data Source Type: - - - Connection String: - - - Connection String - - - Test Result Message - - - Set Up Connection String - - \ No newline at end of file diff --git a/src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.Designer.cs b/src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.Designer.cs deleted file mode 100644 index 9a79035590..0000000000 --- a/src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.Designer.cs +++ /dev/null @@ -1,236 +0,0 @@ -// -// -// -// -// $Revision$ -// - -namespace SharpDbTools.Forms -{ - partial class ConnectionStringDefinitionDialog : System.Windows.Forms.Form - { - /// - /// Designer variable used to keep track of non-visual components. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Disposes resources used by the form. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing) { - if (components != null) { - components.Dispose(); - } - } - base.Dispose(disposing); - } - - /// - /// This method is required for Windows Forms designer support. - /// Do not change the method contents inside the source code editor. The Forms designer might - /// not be able to load this method if it was changed manually. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.connStringPropertyGrid = new System.Windows.Forms.PropertyGrid(); - this.buttonsFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); - this.testButton = new System.Windows.Forms.Button(); - this.submitButton = new System.Windows.Forms.Button(); - this.cancelButton = new System.Windows.Forms.Button(); - this.providerTypeComboBox = new System.Windows.Forms.ComboBox(); - this.dataSourceTypeLabel = new System.Windows.Forms.Label(); - this.connStringResult = new System.Windows.Forms.TextBox(); - this.connectionStringLabel = new System.Windows.Forms.Label(); - this.progressTimer = new System.Windows.Forms.Timer(this.components); - this.statusStrip = new System.Windows.Forms.StatusStrip(); - this.outputMessageTabControl = new System.Windows.Forms.TabControl(); - this.connectionStringTab = new System.Windows.Forms.TabPage(); - this.testResultTab = new System.Windows.Forms.TabPage(); - this.testResultTextBox = new System.Windows.Forms.TextBox(); - this.buttonsFlowLayoutPanel.SuspendLayout(); - this.outputMessageTabControl.SuspendLayout(); - this.connectionStringTab.SuspendLayout(); - this.testResultTab.SuspendLayout(); - this.SuspendLayout(); - // - // connStringPropertyGrid - // - this.connStringPropertyGrid.Location = new System.Drawing.Point(0, 39); - this.connStringPropertyGrid.Name = "connStringPropertyGrid"; - this.connStringPropertyGrid.Size = new System.Drawing.Size(547, 300); - this.connStringPropertyGrid.TabIndex = 0; - // - // buttonsFlowLayoutPanel - // - this.buttonsFlowLayoutPanel.Controls.Add(this.testButton); - this.buttonsFlowLayoutPanel.Controls.Add(this.submitButton); - this.buttonsFlowLayoutPanel.Controls.Add(this.cancelButton); - this.buttonsFlowLayoutPanel.Location = new System.Drawing.Point(3, 447); - this.buttonsFlowLayoutPanel.Name = "buttonsFlowLayoutPanel"; - this.buttonsFlowLayoutPanel.Size = new System.Drawing.Size(312, 34); - this.buttonsFlowLayoutPanel.TabIndex = 1; - // - // testButton - // - this.testButton.Location = new System.Drawing.Point(3, 3); - this.testButton.Name = "testButton"; - this.testButton.Size = new System.Drawing.Size(75, 23); - this.testButton.TabIndex = 0; - this.testButton.Text = "Test"; - this.testButton.UseVisualStyleBackColor = true; - this.testButton.Click += new System.EventHandler(this.TestButtonClick); - // - // submitButton - // - this.submitButton.Location = new System.Drawing.Point(84, 3); - this.submitButton.Name = "submitButton"; - this.submitButton.Size = new System.Drawing.Size(75, 23); - this.submitButton.TabIndex = 1; - this.submitButton.Text = "Submit"; - this.submitButton.UseVisualStyleBackColor = true; - this.submitButton.Click += new System.EventHandler(this.SubmitButtonClick); - // - // cancelButton - // - this.cancelButton.Location = new System.Drawing.Point(165, 3); - this.cancelButton.Name = "cancelButton"; - this.cancelButton.Size = new System.Drawing.Size(75, 23); - this.cancelButton.TabIndex = 2; - this.cancelButton.Text = "Cancel"; - this.cancelButton.UseVisualStyleBackColor = true; - this.cancelButton.Click += new System.EventHandler(this.CancelButtonClick); - // - // providerTypeComboBox - // - this.providerTypeComboBox.FormattingEnabled = true; - this.providerTypeComboBox.Location = new System.Drawing.Point(117, 12); - this.providerTypeComboBox.Name = "providerTypeComboBox"; - this.providerTypeComboBox.Size = new System.Drawing.Size(195, 21); - this.providerTypeComboBox.TabIndex = 2; - this.providerTypeComboBox.SelectedIndexChanged += new System.EventHandler(this.ProviderTypeSelectedIndexChanged); - // - // dataSourceTypeLabel - // - this.dataSourceTypeLabel.Location = new System.Drawing.Point(3, 9); - this.dataSourceTypeLabel.Name = "dataSourceTypeLabel"; - this.dataSourceTypeLabel.Size = new System.Drawing.Size(108, 23); - this.dataSourceTypeLabel.TabIndex = 3; - this.dataSourceTypeLabel.Text = "Data Source Type:"; - this.dataSourceTypeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // connStringResult - // - this.connStringResult.Enabled = false; - this.connStringResult.Location = new System.Drawing.Point(0, 0); - this.connStringResult.Multiline = true; - this.connStringResult.Name = "connStringResult"; - this.connStringResult.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.connStringResult.Size = new System.Drawing.Size(413, 74); - this.connStringResult.TabIndex = 4; - // - // connectionStringLabel - // - this.connectionStringLabel.Location = new System.Drawing.Point(12, 348); - this.connectionStringLabel.Name = "connectionStringLabel"; - this.connectionStringLabel.Size = new System.Drawing.Size(100, 23); - this.connectionStringLabel.TabIndex = 5; - this.connectionStringLabel.Text = "Connection String:"; - // - // progressTimer - // - this.progressTimer.Interval = 1000; - this.progressTimer.Tick += new System.EventHandler(this.ProgressTimerTick); - // - // statusStrip - // - this.statusStrip.Location = new System.Drawing.Point(0, 478); - this.statusStrip.Name = "statusStrip"; - this.statusStrip.Size = new System.Drawing.Size(547, 22); - this.statusStrip.TabIndex = 6; - this.statusStrip.Text = "statusStrip1"; - // - // testResultTab - // - this.outputMessageTabControl.Controls.Add(this.connectionStringTab); - this.outputMessageTabControl.Controls.Add(this.testResultTab); - this.outputMessageTabControl.Location = new System.Drawing.Point(118, 345); - this.outputMessageTabControl.Name = "testResultTab"; - this.outputMessageTabControl.SelectedIndex = 0; - this.outputMessageTabControl.Size = new System.Drawing.Size(417, 100); - this.outputMessageTabControl.TabIndex = 7; - // - // tabPage1 - // - this.connectionStringTab.Controls.Add(this.connStringResult); - this.connectionStringTab.Location = new System.Drawing.Point(4, 22); - this.connectionStringTab.Name = "tabPage1"; - this.connectionStringTab.Padding = new System.Windows.Forms.Padding(3); - this.connectionStringTab.Size = new System.Drawing.Size(409, 74); - this.connectionStringTab.TabIndex = 0; - this.connectionStringTab.Text = "Connection String"; - this.connectionStringTab.UseVisualStyleBackColor = true; - // - // tabPage2 - // - this.testResultTab.Controls.Add(this.testResultTextBox); - this.testResultTab.Location = new System.Drawing.Point(4, 22); - this.testResultTab.Name = "tabPage2"; - this.testResultTab.Padding = new System.Windows.Forms.Padding(3); - this.testResultTab.Size = new System.Drawing.Size(409, 74); - this.testResultTab.TabIndex = 1; - this.testResultTab.Text = "Test Result Message"; - this.testResultTab.UseVisualStyleBackColor = true; - // - // testResultTextBox - // - this.testResultTextBox.Location = new System.Drawing.Point(-5, 0); - this.testResultTextBox.Multiline = true; - this.testResultTextBox.Name = "testResultTextBox"; - this.testResultTextBox.Size = new System.Drawing.Size(418, 77); - this.testResultTextBox.TabIndex = 0; - // - // ConnectionStringDefinitionDialog - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(547, 500); - this.Controls.Add(this.outputMessageTabControl); - this.Controls.Add(this.statusStrip); - this.Controls.Add(this.connectionStringLabel); - this.Controls.Add(this.dataSourceTypeLabel); - this.Controls.Add(this.providerTypeComboBox); - this.Controls.Add(this.buttonsFlowLayoutPanel); - this.Controls.Add(this.connStringPropertyGrid); - this.Name = "ConnectionStringDefinitionDialog"; - this.Text = "Set up Connection String"; - this.buttonsFlowLayoutPanel.ResumeLayout(false); - this.outputMessageTabControl.ResumeLayout(false); - this.connectionStringTab.ResumeLayout(false); - this.connectionStringTab.PerformLayout(); - this.testResultTab.ResumeLayout(false); - this.testResultTab.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - } - private System.Windows.Forms.TabControl outputMessageTabControl; - private System.Windows.Forms.TextBox testResultTextBox; - private System.Windows.Forms.TabPage testResultTab; - private System.Windows.Forms.TabPage connectionStringTab; - - private System.Windows.Forms.Timer progressTimer; - private System.Windows.Forms.StatusStrip statusStrip; - private System.Windows.Forms.TextBox connStringResult; - private System.Windows.Forms.Label connectionStringLabel; - private System.Windows.Forms.Label dataSourceTypeLabel; - private System.Windows.Forms.ComboBox providerTypeComboBox; - private System.Windows.Forms.Button cancelButton; - private System.Windows.Forms.Button submitButton; - private System.Windows.Forms.Button testButton; - private System.Windows.Forms.FlowLayoutPanel buttonsFlowLayoutPanel; - private System.Windows.Forms.PropertyGrid connStringPropertyGrid; - } -} diff --git a/src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.cs b/src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.cs deleted file mode 100644 index 510b753b01..0000000000 --- a/src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.cs +++ /dev/null @@ -1,286 +0,0 @@ -// -// -// -// -// $Revision: 1684 $ -// - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data.Common; -using System.Windows.Forms; -using System.Resources; -using System.Reflection; -using System.Text; - -using SharpDbTools.Data; - -namespace SharpDbTools.Forms -{ - /// - /// This class creates a dialog that can be used to create and test connection strings - /// that can be used with .net 2.0 DbProviders. - /// It utilises .net 2.0 configuration to discover any DbProviderFactories that are - /// installed and configured in machine.config, app.config or user.config using - /// standard .net 2.0 apis. - /// It then enables a user to browse the properties of each type of db connection, - /// set values for them and test the resulting connection string. - /// When the submit button is clicked the dialog is dismissed and the connection - /// string constructed is accessible through the ConnectionString property of the dialog. - /// - public partial class ConnectionStringDefinitionDialog - { - ToolStripProgressBar connectionTestProgressBar = new ToolStripProgressBar(); - ConnectionTestBackgroundWorker testConnectionBackgroundWorker; - string resultMessage; - string succeededMessage; - string failedMessage; - string invariantName; - ConnectionTestState connectionTestState = ConnectionTestState.UnTested; - - public ConnectionStringDefinitionDialog() - { - // - // The InitializeComponent() call is required for Windows Forms designer support. - // - InitializeComponent(); - - // overwrite Text properties using resMgr - - ResourceManager resMgr = new ResourceManager("ICSharpCode.DataTools.UI" + ".Resources.Strings", - Assembly.GetAssembly(typeof(ConnectionStringDefinitionDialog))); - this.testButton.Text = resMgr.GetString("SharpDbTools.Forms.TestButton"); - this.submitButton.Text = resMgr.GetString("SharpDbTools.Forms.SubmitButton"); - this.cancelButton.Text = resMgr.GetString("SharpDbTools.Forms.CancelButton"); - this.dataSourceTypeLabel.Text = resMgr.GetString("SharpDbTools.Forms.DataSourceTypeLabel"); - this.connectionStringLabel.Text = resMgr.GetString("SharpDbTools.Forms.ConnectionStringLabel"); - this.connectionStringTab.Text = resMgr.GetString("SharpDbTools.Forms.ConnectionStringTab"); - this.testResultTab.Text = resMgr.GetString("SharpDbTools.Forms.TestResultTab"); - this.Text = resMgr.GetString("SharpDbTools.Forms.ConnectionStringDefinitionDialog"); - this.succeededMessage = resMgr.GetString("SharpDbTools.Forms.ConnectionSucceededMsg"); - this.failedMessage = resMgr.GetString("SharpDbTools.Forms.ConnectionFailedMsg"); - - - this.connStringPropertyGrid.PropertyValueChanged += - new PropertyValueChangedEventHandler(this.ConnStringAttributesViewPropertyValueChanged); - // add a ProgressBar to the statusString - this.statusStrip.Items.Add(connectionTestProgressBar); - this.connectionTestProgressBar.Step = 10; - this.connectionTestProgressBar.Minimum = 0; - this.connectionTestProgressBar.Maximum = 150; - } - - public string InvariantName { - get { - return this.invariantName; - } - set { - this.invariantName = value; - } - } - - public ConnectionTestState ConnectionTestState { - get { - return this.connectionTestState; - } - } - - public string ResultMessage - { - get - { - return resultMessage; - } - set - { - resultMessage = value; - } - } - - public DbConnectionStringBuilder ConnectionStringBuilder - { - get - { - return (DbConnectionStringBuilder)this.connStringPropertyGrid.SelectedObject; - } - } - - public string ConnectionString - { - get - { - return ((DbConnectionStringBuilder)this.connStringPropertyGrid.SelectedObject).ConnectionString; - } - } - - protected override void OnLoad(EventArgs e) - { - // - // set the PropertyGrid to browse the available DbProviders - // - - base.OnLoad(e); - DbProvidersService service = DbProvidersService.GetDbProvidersService(); - if (service.ErrorMessages.Count > 0) { - StringBuilder b = new StringBuilder(); - foreach(string s in service.ErrorMessages) { - b.Append(s).Append("\n"); - } - MessageBox.Show(b.ToString(), "Non-fatal Exception caught", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - } - - List names = service.Names; - this.providerTypeComboBox.DataSource = names; - this.connStringResult.Text = this.ConnectionString; - } - - void CancelButtonClick(object sender, System.EventArgs e) - { - this.DialogResult = DialogResult.Cancel; - this.Close(); - } - - void ProviderTypeSelectedIndexChanged(object sender, System.EventArgs e) - { - string selection = (string)this.providerTypeComboBox.SelectedItem; - DbProvidersService service = DbProvidersService.GetDbProvidersService(); - DbProviderFactory factory = service[selection]; - DbConnectionStringBuilder builder = factory.CreateConnectionStringBuilder(); - connStringPropertyGrid.SelectedObject = builder; - } - - void ConnStringAttributesViewPropertyValueChanged(Object s, PropertyValueChangedEventArgs args) - { - // looking for changes to the ConnectionString property in the PropertyGrid - this.connStringResult.Text = this.ConnectionString; - this.outputMessageTabControl.SelectTab(this.connectionStringTab); - ResetTestResultTextBox(); - } - - void TestButtonClick(object sender, System.EventArgs e) - { - string dbTypeName = (string)this.providerTypeComboBox.SelectedItem; - testConnectionBackgroundWorker = new ConnectionTestBackgroundWorker(dbTypeName); - testConnectionBackgroundWorker.WorkerSupportsCancellation = false; - progressTimer.Enabled = true; - testConnectionBackgroundWorker.DoWork += // TODO: This may result in duplicate bindings - new DoWorkEventHandler(this.TestConnectionBackgroundWorkerDoWork); - testConnectionBackgroundWorker.RunWorkerCompleted += - new RunWorkerCompletedEventHandler(TestConnectionRunWorkerComplete); - testConnectionBackgroundWorker.RunWorkerAsync(); - } - - void ProgressTimerTick(object sender, System.EventArgs e) - { - this.BeginInvoke(new EventHandler(UpdateProgressBar)); - } - - void UpdateProgressBar(object sender, EventArgs e) - { - ToolStripProgressBar p = connectionTestProgressBar; - if (p.Value == p.Maximum) p.Value = 0; - p.PerformStep(); - } - - void SetTestResultTextBox() - { - this.testResultTextBox.Text = ResultMessage; - this.outputMessageTabControl.SelectTab(this.testResultTab); - } - - void ResetTestResultTextBox() - { - this.testResultTextBox.Text = ""; - this.connectionTestState = ConnectionTestState.UnTested; - } - - void TestConnectionBackgroundWorkerDoWork(object sender, DoWorkEventArgs e) - { - DbConnection connection = null; - try - { - // get the current name - - ConnectionTestBackgroundWorker bw = sender as ConnectionTestBackgroundWorker; - string currentDbTypeName = bw.DatabaseType; - - // get the DbProviderFactory for this name - - DbProvidersService service = DbProvidersService.GetDbProvidersService(); - DbProviderFactory factory = service[currentDbTypeName]; - - // get a connection object or this factory - - connection = factory.CreateConnection(); - connection.ConnectionString = this.ConnectionString; - - connection.Open(); - e.Result = this.succeededMessage; //"Connection Succeeded"; - connectionTestState = ConnectionTestState.TestSucceeded; - } - catch(Exception ex) - { - e.Result = - this.failedMessage + ex.Message; /*"Connection Failed: "*/ - connectionTestState = ConnectionTestState.TestFailed; - } - finally - { - if (connection != null) - { - connection.Close(); - } - } - } - - void TestConnectionRunWorkerComplete(object sender, RunWorkerCompletedEventArgs args) - { - ResultMessage = args.Result as string; - this.Invoke(new EventHandler(TestConnectionCompleted)); - } - - void TestConnectionCompleted(object sender, EventArgs args) - { - progressTimer.Enabled = false; - connectionTestProgressBar.Value = 0; - SetTestResultTextBox(); - testConnectionBackgroundWorker.Dispose(); - } - - void SubmitButtonClick(object sender, System.EventArgs e) - { - string name = (string)this.providerTypeComboBox.SelectedItem; - DbProvidersService service = DbProvidersService.GetDbProvidersService(); - this.InvariantName = service.GetInvariantName(name); - - this.DialogResult = DialogResult.OK; - this.Close(); - } - } - - public enum ConnectionTestState - { - UnTested, - TestFailed, - TestSucceeded - } - - class ConnectionTestBackgroundWorker: BackgroundWorker - { - private string dbTypeName; - - public ConnectionTestBackgroundWorker(string dbTypeName): base() - { - this.dbTypeName = dbTypeName; - } - - public string DatabaseType - { - get - { - return dbTypeName; - } - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.resx b/src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.resx deleted file mode 100644 index 157d9061d2..0000000000 --- a/src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 247, 17 - - - 371, 17 - - \ No newline at end of file diff --git a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Resources/Strings.resx b/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Resources/Strings.resx deleted file mode 100644 index 7080a7d118..0000000000 --- a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Resources/Strings.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/ServerBrowserTool.csproj b/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/ServerBrowserTool.csproj deleted file mode 100644 index fa6e947009..0000000000 --- a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/ServerBrowserTool.csproj +++ /dev/null @@ -1,75 +0,0 @@ - - - Library - ICSharpCode.ServerBrowserTool - ICSharpCode.ServerBrowserTool - Debug - AnyCPU - {D721EAA4-8A40-4EF0-A011-5862159BE621} - False - False - False - Auto - 4194304 - AnyCPU - 4096 - 4 - false - - - ..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\ - False - DEBUG;TRACE - true - Full - True - - - ..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\ - True - TRACE - False - None - False - - - - - - - - - - Src\Configuration\GlobalAssemblyInfo.cs - - - - - - - - - - - - - - - - - - Always - - - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} - ICSharpCode.Core - False - - - {2748AD25-9C63-4E12-877B-4DCE96FBED54} - ICSharpCode.SharpDevelop - False - - - - \ No newline at end of file diff --git a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/ServerBrowserTool.sln b/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/ServerBrowserTool.sln deleted file mode 100644 index 3c3a31667c..0000000000 --- a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/ServerBrowserTool.sln +++ /dev/null @@ -1,6 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.1.0.1900 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerBrowserTool", "ServerBrowserTool.csproj", "{D721EAA4-8A40-4EF0-A011-5862159BE621}" -EndProject -Global -EndGlobal diff --git a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/SharpServerTools.addin b/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/SharpServerTools.addin deleted file mode 100644 index a48fed869d..0000000000 --- a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/SharpServerTools.addin +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Configuration/AssemblyInfo.cs b/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Configuration/AssemblyInfo.cs deleted file mode 100644 index edee911002..0000000000 --- a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Configuration/AssemblyInfo.cs +++ /dev/null @@ -1,21 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System.Reflection; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("ServerBrowserTool")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] diff --git a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/IInitializable.cs b/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/IInitializable.cs deleted file mode 100644 index 50a2dd1233..0000000000 --- a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/IInitializable.cs +++ /dev/null @@ -1,19 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; - -namespace SharpServerTools.Forms -{ - /// - /// Implemented by anything that is initializable - /// - public interface IInitializable - { - void Initialize(); - } -} diff --git a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ISupportsDragDrop.cs b/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ISupportsDragDrop.cs deleted file mode 100644 index 6e6429ed4e..0000000000 --- a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ISupportsDragDrop.cs +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Created by SharpDevelop. - * User: dickon - * Date: 04/03/2007 - * Time: 09:14 - * - * To change this template use Tools | Options | Coding | Edit Standard Headers. - */ - -using System; -using System.Windows.Forms; - -namespace SharpServerTools.Forms -{ - /// - /// This interface is implemented by any plugin to ServerExplorer that supports drag and drop - /// of some of its data - /// - public interface ISupportsDragDrop - { - void HandleMouseDownEvent(object sender, MouseEventArgs e); - } -} diff --git a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/NodeAwareContextMenuStrip.cs b/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/NodeAwareContextMenuStrip.cs deleted file mode 100644 index bb6a85fa27..0000000000 --- a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/NodeAwareContextMenuStrip.cs +++ /dev/null @@ -1,28 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Windows.Forms; - -namespace SharpServerTools.Forms -{ - public class NodeAwareContextMenuStrip : ContextMenuStrip - { - TreeNode treeNodeAttached; - - public NodeAwareContextMenuStrip(TreeNode treeNodeAttached) : base() - { - this.treeNodeAttached = treeNodeAttached; - } - - public TreeNode TreeNode { - get { - return treeNodeAttached; - } - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ProgressEllipsis.cs b/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ProgressEllipsis.cs deleted file mode 100644 index 7beb538beb..0000000000 --- a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ProgressEllipsis.cs +++ /dev/null @@ -1,56 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Text; - -namespace SharpServerTools.Forms -{ - /// - /// Shows progress as a series of ellipses. Not threadsafe. - /// - public class ProgressEllipsis - { - int noOfDots; - StringBuilder currentString; - int currentValue; - - public ProgressEllipsis() - { - } - - public ProgressEllipsis(int noOfDots) - { - this.noOfDots = noOfDots; - currentString = new StringBuilder(); - currentValue = 0; - } - - public void performStep() - { - currentValue++; - if ((currentValue % noOfDots) == 0) { - currentValue = 0; - currentString.Remove(0, currentString.Length-1); - } else { - currentString.Append("."); - } - } - - public string Text { - get { - return currentString.ToString(); - } - } - - public int Value { - set { - this.currentValue = value; - } - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/RebuildRequiredEvents.cs b/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/RebuildRequiredEvents.cs deleted file mode 100644 index ced238e70e..0000000000 --- a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/RebuildRequiredEvents.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; - -namespace SharpServerTools.Forms -{ - /// - /// An IRebuildable can be asked to rebuild its Node tree - /// - public interface IRebuildable - { - void Rebuild(); - } - - /// - /// An IRequiresRebuildSource can request the ServerToolTreeView to rebuild - /// it by emitting the RebuildRequiredEvent - /// - public interface IRequiresRebuildSource - { - event RebuildRequiredEventHandler RebuildRequiredEvent; - } - - public delegate void RebuildRequiredEventHandler(object sender, RebuildRequiredEventArgs e); - - /// - /// An IRequiresRebuildSource should add a reference to itself to - /// this event if it wants to be rebuilt. - /// The parent of an IRequiresRebuildSource may or may not add itself - /// and resend the event to the ServerToolTreeView depending on the - /// relationship between parent and child. - /// - public class RebuildRequiredEventArgs: EventArgs - { - List rebuildNodes = new List(); - - public IEnumerable Nodes { - get { - return rebuildNodes; - } - } - - public void AddNode(IRebuildable node) - { - rebuildNodes.Add(node); - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ServerBrowserTool.cs b/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ServerBrowserTool.cs deleted file mode 100644 index b266225447..0000000000 --- a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ServerBrowserTool.cs +++ /dev/null @@ -1,64 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Windows.Forms; -using ICSharpCode.Core; -using ICSharpCode.SharpDevelop.Gui; - -namespace SharpServerTools.Forms -{ - /// - /// Enables a user to browse metadata associated with a db server and to open resources - /// referenced therein. The intention is to extend this to other server processes over - /// time. - /// - public class ServerBrowserTool : AbstractPadContent - { - Panel ctl; - ServerToolTreeView dbTree; - - /// - /// ServerBrowserTool hosts one or more TreeViews providing views of types - /// of server. Currently it shows only relational database servers. - /// - public ServerBrowserTool() - { - LoggingService.Debug("Loading ServerBrowserTool"); - dbTree = new ServerToolTreeView(); - dbTree.Dock = DockStyle.Fill; - ctl = new Panel(); - ctl.Controls.Add(dbTree); - dbTree.Rebuild(); - } - - /// - /// The representing the pad - /// - public override Control Control { - get { - return ctl; - } - } - - /// - /// Rebuildes the pad - /// - public override void RedrawContent() - { - - } - - /// - /// Cleans up all used resources - /// - public override void Dispose() - { - ctl.Dispose(); - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ServerToolTreeView.cs b/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ServerToolTreeView.cs deleted file mode 100644 index c1ae2fd0c6..0000000000 --- a/src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ServerToolTreeView.cs +++ /dev/null @@ -1,108 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Windows.Forms; - -using ICSharpCode.Core; - -namespace SharpServerTools.Forms -{ - /// - /// Provides a tree-structured visual rendering of server instances. - /// This class should not hold references to server data, but should render its - /// content using data retrieved from business services responsible for - /// maintaining this model/s of underlying services. - /// - public class ServerToolTreeView : TreeView, IRebuildable - { - public const string SERVERTOOL_PATH = "/SharpServerTools/ServerTool"; - - public ServerToolTreeView(): base() - { - - AddInTreeNode node = - AddInTree.GetTreeNode(SERVERTOOL_PATH); - List codons = node.Codons; - foreach (Codon codon in codons) { - // create an instance of the relevant ServerTool TreeNode - string id = codon.Id; - TreeNode treeNode = (TreeNode)node.BuildChildItem(id, null, null); - - // a ServerTool plugin can register to be refreshed by the ServerToolTreeView - // control by implementing the IRequiresRebuildSource interface - - IRequiresRebuildSource s = treeNode as IRequiresRebuildSource; - - if (s != null) { - s.RebuildRequiredEvent += new RebuildRequiredEventHandler(RebuildRequiredNotify); - } - - // a ServerTool plugin can also register to handle drag-n-drop if it implements - // the required interface - - ISupportsDragDrop d = treeNode as ISupportsDragDrop; - - if (d != null) { - this.MouseDown += new MouseEventHandler(d.HandleMouseDownEvent); - } - - this.Nodes.Add(treeNode); - } - -// Type dbExplorerType = Type.GetType("SharpDbTools.Forms.DatabaseExplorerTreeNode, SharpDbTools"); -// TreeNode dbExplorerNode = (TreeNode)Activator.CreateInstance(dbExplorerType); -// IRequiresRebuildSource s = dbExplorerNode as IRequiresRebuildSource; -// s.RebuildRequiredEvent += new RebuildRequiredEventHandler(RebuildRequiredNotify); -// this.Nodes.Add(dbExplorerNode); - } - - public void RebuildChildren(IEnumerable children) - { - // Rebuild each of the root nodes in the ServerToolTreeView - // Currently this comprises the Database Explorer - IEnumerable n = children; - if (n == null) { - n = this.Nodes; - } - - this.BeginUpdate(); - foreach (object o in n) { - IRebuildable se = (IRebuildable)o; - se.Rebuild(); - } - this.EndUpdate(); - } - - private void RebuildRequiredNotify(object sender, RebuildRequiredEventArgs e) - { - IEnumerable children = e.Nodes; - if (this.InvokeRequired) { - this.Invoke(new RebuildChildrenDelegate(RebuildChildren), new object[] {children}); - } - else { - RebuildChildren(children); - } - - } - - public void Rebuild() - { - if (this.InvokeRequired) { - this.Invoke(new RebuildChildrenDelegate(RebuildChildren), new object[] {null}); - } - else { - this.RebuildChildren(null); - } - } - - } - public delegate void RebuildChildrenDelegate(IEnumerable children); - -} diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/DataTools.AddIn.csproj b/src/AddIns/Misc/SharpServerTools/SharpDbTools/DataTools.AddIn.csproj deleted file mode 100644 index 235774bbde..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/DataTools.AddIn.csproj +++ /dev/null @@ -1,109 +0,0 @@ - - - Library - ICSharpCode.DataTools.AddIn - ICSharpCode.DataTools.AddIn - Debug - AnyCPU - {93B2D6DF-7588-40C0-8A35-CA0DD7328FC3} - False - False - 4 - false - - - ..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\ - False - DEBUG;TRACE - true - Full - True - - - ..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\ - True - TRACE - False - None - False - - - False - Auto - 4194304 - AnyCPU - 4096 - - - - - - - - - - - Src\Configuration\GlobalAssemblyInfo.cs - - - - - - SQLTool.cs - - - - - - - - - - - SQLTool.cs - - - - - - - - - - - - - - - - - - {2D18BE89-D210-49EB-A9DD-2246FBB3DF6D} - ICSharpCode.TextEditor - False - - - {2748AD25-9C63-4E12-877B-4DCE96FBED54} - ICSharpCode.SharpDevelop - False - - - {35CEF10F-2D4C-45F2-9DD1-161E0FEC583C} - ICSharpCode.Core - False - - - {51783FC4-D8D2-4BFB-A1F1-AC8857CF3ED0} - DataTools.Model - - - {87C0E3D9-0DFD-4F6D-8E38-408AAF73F4EE} - DataTools.UI - - - {D721EAA4-8A40-4EF0-A011-5862159BE621} - ServerBrowserTool - - - - \ No newline at end of file diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/SQL.xshd b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/SQL.xshd deleted file mode 100644 index d6bc0542c6..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/SQL.xshd +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - =!><+-/*%&|^~.}{,;][?:() - - - -- - - - - /* - */ - - - - " - " - - - - ' - ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/Strings.resx b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/Strings.resx deleted file mode 100644 index aa4fa3cc74..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/Strings.resx +++ /dev/null @@ -1,205 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Tables - - - Procedures - - - Functions - - - - Views - - - Users - - - Db Objects - - - Database Explorer - - - Add Connection - - - Delete Connection - - - Save All - - - Connection Properties - - - No Metadata - - - Set Connection String - - - Load Metadata From Connection - - - Load Metadata From File - - - Open SQL Tool - - - Connection String: - - - Invariant Name: - - - Connection Succeeded - - - Connection Failed - - - Test - - - Submit - - - Cancel - - - Data Source Type: - - - Connection String: - - - Connection String - - - Test Result Message - - - Set Up Connection String - - \ No newline at end of file diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/SyntaxModes.xml b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/SyntaxModes.xml deleted file mode 100644 index 3d2364dd5d..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/SyntaxModes.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/SharpDbTools.sln b/src/AddIns/Misc/SharpServerTools/SharpDbTools/SharpDbTools.sln deleted file mode 100644 index d3ccf3f2f3..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/SharpDbTools.sln +++ /dev/null @@ -1,6 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.1.0.1900 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpDbTools", "SharpDbTools.csproj", "{93B2D6DF-7588-40C0-8A35-CA0DD7328FC3}" -EndProject -Global -EndGlobal diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Configuration/AssemblyInfo.cs b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Configuration/AssemblyInfo.cs deleted file mode 100644 index 0b02381459..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Configuration/AssemblyInfo.cs +++ /dev/null @@ -1,20 +0,0 @@ -// -// -// -// -// $Revision: 1760 $ -// - -using System.Reflection; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("SharpDbTools")] -[assembly: AssemblyDescription("Addin for SharpDevelop 2.0")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms.TextEditor/SQLTextEditorControl.cs b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms.TextEditor/SQLTextEditorControl.cs deleted file mode 100644 index 46b4df503c..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms.TextEditor/SQLTextEditorControl.cs +++ /dev/null @@ -1,109 +0,0 @@ -/* - * User: dickon - * Date: 13/12/2006 - * Time: 16:02 - * - */ - -using System; - -using ICSharpCode.TextEditor; -using ICSharpCode.TextEditor.Gui.CompletionWindow; -using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; -using ICSharpCode.SharpDevelop.Gui; -using ICSharpCode.Core; -using System.Windows.Forms; - -namespace SharpDbTools.Forms.TextEditor -{ - /// - /// Description of SQLTextEditorControl. - /// - public class SQLTextEditorControl: TextEditorControl - { - public SQLTextEditorControl(): base() - { - this.ActiveTextAreaControl.TextArea.KeyEventHandler += new ICSharpCode.TextEditor.KeyEventHandler(KeyPressed); - } - - - protected override void InitializeTextAreaControl(TextAreaControl control) - { - LoggingService.Debug(this.GetType().Name + ": initialising TextArea for SQLTextEditorControl..."); - control.TextArea.KeyEventHandler += new ICSharpCode.TextEditor.KeyEventHandler(KeyPressed); - } - - bool inKeyPressed = false; - CodeCompletionWindow codeCompletionWindow = null; - private bool KeyPressed(char next) - { - if (inKeyPressed) return false; - inKeyPressed = true; - LoggingService.Debug(this.GetType().Name + ": KeyPressed, handling character: " + next); - try { - // we already have a CodeCompletionWindow open, so it will handle - // key presses at this point - if (codeCompletionWindow != null && !codeCompletionWindow.IsDisposed) { - return false; // not handling it yet - } - - // if (CodeCompletionOptions.EnableCodeCompletion) { - // foreach (ICodeCompletionBinding ccBinding in CodeCompletionBindings) { - // if (ccBinding.HandleKeyPress(this, ch)) - // return false; - // } - // } - - // Lets just assume for now that we have only one binding, that is '.', which - // will result in an attempt to show field name completions upon a table name - // or alias - - if (next == '.') { - ICompletionDataProvider completionDataProvider = new TestCodeCompletionProvider(); // TODO: create a simple provider that just returns a couple of strings - codeCompletionWindow = - CodeCompletionWindow.ShowCompletionWindow(WorkbenchSingleton.MainForm, - this, this.FileName, completionDataProvider, next); - if (codeCompletionWindow != null) { - codeCompletionWindow.Closed += new EventHandler(CloseCodeCompletionWindow); - } - return false; - } - - } catch(Exception ex) { - LoggingService.Error(this.GetType().FullName, ex); - } finally { - inKeyPressed = false; - } - return false; - } - - private void CloseCodeCompletionWindow(object sender, EventArgs args) - { - - } - } - - class TestCodeCompletionProvider : AbstractCompletionDataProvider, ICompletionDataProvider - { - /// - /// Testing at this stage, aiming to get some test data into a code completion window - /// - /// - /// - /// - /// - public override ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped) - { - Random r = new Random(); - return new DefaultCompletionData[] { new TestCompletionData("Test" + r.Next(), "Test1", 0), - new TestCompletionData("Test" + r.Next(), "Test2", 0) }; - } - } - - class TestCompletionData: DefaultCompletionData - { - public TestCompletionData(string text, string description, int imageIndex): base(text, description, imageIndex) - { - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/DatabaseExplorerTreeNode.cs b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/DatabaseExplorerTreeNode.cs deleted file mode 100644 index 52595636c7..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/DatabaseExplorerTreeNode.cs +++ /dev/null @@ -1,186 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; -using System.Windows.Forms; - -using ICSharpCode.Core; -using ICSharpCode.SharpDevelop.Gui; - -using SharpDbTools.Data; - -using SharpServerTools.Forms; - -namespace SharpDbTools.Forms -{ - /// - /// Description of DatabaseExplorerNode. - /// Hold minimal state - access state through the DbModelInfoService - /// - public class DatabaseExplorerTreeNode: TreeNode, IRebuildable, IRequiresRebuildSource, ISupportsDragDrop - { - static DatabaseExplorerTreeNode() - { - ResourceService.RegisterStrings("ICSharpCode.DataTools.AddIn.Resources.Strings", typeof(DatabaseExplorerTreeNode).Assembly); - } - - public DatabaseExplorerTreeNode(): base() - { - this.Text = ResourceService.GetString("SharpDbTools.Forms.DbExplorerNodeName"); - ContextMenuStrip cMenu = new ContextMenuStrip(); - ToolStripMenuItem addConnectionMenuItem = - new ToolStripMenuItem(); - addConnectionMenuItem.Text = - ResourceService.GetString("SharpDbTools.Forms.AddConnectionMenu"); - addConnectionMenuItem.Click += new EventHandler(AddDbConnectionClickHandler); - - ToolStripMenuItem deleteConnectionMenuItem = - new ToolStripMenuItem(); - deleteConnectionMenuItem.Text = - ResourceService.GetString("SharpDbTools.Forms.DeleteConnectionMenu"); - deleteConnectionMenuItem.Click += new EventHandler(DeleteDbConnectionClickHandler); - - ToolStripMenuItem saveMetadataMenuItem = - new ToolStripMenuItem(); - saveMetadataMenuItem.Text = - ResourceService.GetString("SharpDbTools.Forms.SaveAllMenu"); - saveMetadataMenuItem.Click += new EventHandler(SaveDbModelInfoClickHandler); - - - - - cMenu.Items.AddRange(new ToolStripMenuItem[] - { - addConnectionMenuItem, - deleteConnectionMenuItem, - saveMetadataMenuItem - } - ); - this.ContextMenuStrip = cMenu; - } - - public void Rebuild() - { - this.Nodes.Clear(); - foreach (string name in DbModelInfoService.Names) { - LoggingService.Debug(this.GetType().ToString() + " getting DbModelInfoTreeNode for node: " + name); - DbModelInfoTreeNode dbModelInfoNode = CreateDbModelInfoNode(name); - dbModelInfoNode.RebuildRequiredEvent += new RebuildRequiredEventHandler(RebuildRequiredNotify); - this.Nodes.Add(dbModelInfoNode); - } - } - - public event RebuildRequiredEventHandler RebuildRequiredEvent; - - /// - /// DatabaseExplorerTreeNode chucks away any existing Nodes and recreates its tree when it - /// is triggered. - /// - /// - /// - private void RebuildRequiredNotify(object sender, RebuildRequiredEventArgs e) - { - // adding this node because it wants to be rebuilt. - e.AddNode(this); - this.FireRebuildRequired(this, e); - } - - private void FireRebuildRequired(object sender, RebuildRequiredEventArgs e) - { - if (this.RebuildRequiredEvent != null) { - RebuildRequiredEvent(this, e); - } - } - - private DbModelInfoTreeNode CreateDbModelInfoNode(string name) - { - return new DbModelInfoTreeNode(name); - } - - /// - /// Uses a dialog to get the logical name of a new Connection then - /// adds a new DbModelInfo for it to the cache and updates the DatabaseServer - /// Tree. - /// - /// - /// - - private void AddDbConnectionClickHandler(object sender, EventArgs e) - { - LoggingService.Debug("add connection clicked"); - - // get the logical name of the new connection - - string logicalName = MessageService.ShowInputBox("Connection name", "Please provide the name for your db connection:", ""); - if (String.IsNullOrEmpty(logicalName)) return; - - LoggingService.Debug("name received is: " + logicalName); - - // add a new DbModelInfo to the cache - - DbModelInfoService.Add(logicalName, null, null); - - // rebuild the database server node - - RebuildRequiredEventArgs e1 = new RebuildRequiredEventArgs(); - e1.AddNode(this as IRebuildable); - this.FireRebuildRequired(this, e1); - } - - private void DeleteDbConnectionClickHandler(object sender, EventArgs e) - { - LoggingService.Debug("delete connection clicked"); - } - - private void SaveDbModelInfoClickHandler(object sender, EventArgs e) - { - // save each DbModelInfo separately, confirming overwrite where necessary - - LoggingService.Debug("save all metadata clicked - will iterate through each and attempt to save"); - IList names = DbModelInfoService.Names; - foreach (string name in names) { - bool saved = DbModelInfoService.SaveToFile(name, false); - if (!saved) { - DialogResult result = MessageBox.Show("Overwrite existing file for connection: " + name + "?", - "File exists for connection", MessageBoxButtons.YesNo, - MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); - if (result.Equals(DialogResult.Yes)) { - DbModelInfoService.SaveToFile(name, true); - } - } - } - } - - /// - /// If a DbModelInfoTreeNode is selected then the desired drag and drop behaviour - /// is to pass the ConnectionString to drop target. - /// - /// - /// - public void HandleMouseDownEvent(object sender, MouseEventArgs e) - { - LoggingService.Debug(this.GetType().Name + " handling MouseDownEvent"); - TreeView parent = this.TreeView; - TreeNode currentlySelected = parent.SelectedNode; - - // If the user has selected a TreeNode for a specific connection, and has the right - // mouse button down, then initiate a drag drop operation - DbModelInfoTreeNode infoNode = currentlySelected as DbModelInfoTreeNode; - if (infoNode == null) return; - string logicalConnectionName = infoNode.LogicalConnectionName; - DbModelInfo info = DbModelInfoService.GetDbModelInfo(logicalConnectionName); - if (info == null) return; - string connectionString = info.ConnectionString; - LoggingService.Debug("drag drop operation initiated for ConnectionString: " + connectionString); - if (connectionString != null) { - parent.DoDragDrop(connectionString, DragDropEffects.Copy); - } - - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/DbModelInfoTreeNode.cs b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/DbModelInfoTreeNode.cs deleted file mode 100644 index 3ff03511a5..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/DbModelInfoTreeNode.cs +++ /dev/null @@ -1,305 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.ComponentModel; -using System.Data.Common; -using System.Windows.Forms; - -using ICSharpCode.Core; -using ICSharpCode.SharpDevelop.Gui; - -using SharpDbTools.Data; -using SharpServerTools.Forms; - -namespace SharpDbTools.Forms -{ - /// - /// Renders a view of the metadata and connection properties for a single - /// database connection. It is an IRequiresRebuildSource and can emit - /// RequiresRebuildEvents when the metadata etc are changed, but the - /// DatabaseExplorerTreeNode disposes of these and constructs new ones - /// when this occurs, so it is not an IRebuildable - /// - public class DbModelInfoTreeNode: TreeNode, IRequiresRebuildSource - { - BackgroundWorker backgroundWorker; - ProgressEllipsis progress; - Timer timer; - const string fileLoadMessage = ": loading from file"; - const string connectionLoadMessage = ": loading from connection"; - string message; - - public DbModelInfoTreeNode(string name): base(name) - { - // use tag to carry the logical connection name - - this.Tag = name; - - // create and add the menustrip for this node - - NodeAwareContextMenuStrip cMenu = new NodeAwareContextMenuStrip(this); - - // create menu items - - ToolStripMenuItem setConnectionStringMenuItem = - new ToolStripMenuItem(); - setConnectionStringMenuItem.Text = ResourceService.GetString("SharpDbTools.Forms.SetConnectionStringMenu"); - setConnectionStringMenuItem.Click += new EventHandler(SetConnectionStringOnDbModelInfoClickHandler); - - ToolStripMenuItem loadMetadataFromConnectionMenuItem = - new ToolStripMenuItem(); - loadMetadataFromConnectionMenuItem.Text = ResourceService.GetString("SharpDbTools.Forms.LoadMetadataFromConnectionMenu"); - loadMetadataFromConnectionMenuItem.Click += new EventHandler(LoadMetadataFromConnectionClickHandler); - - ToolStripMenuItem loadMetadataFromFileMenuItem = - new ToolStripMenuItem(); - loadMetadataFromFileMenuItem.Text = ResourceService.GetString("SharpDbTools.Forms.LoadMetadataFromFileMenu"); - loadMetadataFromFileMenuItem.Click += new EventHandler(LoadMetadataFromFileClickHandler); - - ToolStripMenuItem openSQLToolMenuItem = new ToolStripMenuItem(); - openSQLToolMenuItem.Text = ResourceService.GetString("SharpDbTools.Forms.OpenSQLToolMenu"); - openSQLToolMenuItem.Click += new EventHandler(OpenSQLToolClickHandler); - - cMenu.Items.AddRange(new ToolStripMenuItem[] - { - setConnectionStringMenuItem, - loadMetadataFromConnectionMenuItem, - loadMetadataFromFileMenuItem, - openSQLToolMenuItem - }); - - this.ContextMenuStrip = cMenu; - this.Nodes.Clear(); - TreeNode connectionPropsNode = CreateConnectionPropertiesNode(this.LogicalConnectionName); - TreeNode dbNode = CreateMetaDataNode(this.LogicalConnectionName); - this.Nodes.Add(connectionPropsNode); - this.Nodes.Add(dbNode); - - timer = new Timer(); - timer.Interval = 1000; - timer.Tick += new EventHandler(this.TimerClick); - progress = new ProgressEllipsis(4); - } - - public string LogicalConnectionName { - get { - return this.Text; - } - } - - public event RebuildRequiredEventHandler RebuildRequiredEvent; - - protected void FireRebuildRequired() - { - // HERE: the null eventargs indicates no desire to be rebuilt - is this correct? - if (RebuildRequiredEvent != null) { - // This object does not want to be rebuilt - it is discarded when there is - // a change in the underlying model. So, an event is posted without a ref - // to this object. - RebuildRequiredEventArgs eventArgs = new RebuildRequiredEventArgs(); - RebuildRequiredEvent(this, eventArgs); - } - } - - private TreeNode CreateConnectionPropertiesNode(string name) - { - // create sub TreeNodes for the connection string and invariant name if they exist - LoggingService.Debug("Looking for a Db Model Info for connection with name: " + name); - DbModelInfo modelInfo = DbModelInfoService.GetDbModelInfo(name); - - if (modelInfo == null) { - LoggingService.Error("could not find a logical connection named: " + name); - throw new ArgumentException("this logical connection name is not defined: " + name); - } - string connectionString = modelInfo.ConnectionString; - string invariantName = modelInfo.InvariantName; - - TreeNode attributesNode = new TreeNode("Connection Properties"); - attributesNode.Text = ResourceService.GetString("SharpDbTools.Forms.ConnectionPropertiesNodeName"); - - if (connectionString != null) { - TreeNode cstringNode = new TreeNode(); - cstringNode.Text = ResourceService.GetString("SharpDbTools.Forms.ConnectionStringNodeName") + connectionString; - attributesNode.Nodes.Add(cstringNode); - } - - if (invariantName != null) { - TreeNode invNameNode = new TreeNode(); - invNameNode.Text = ResourceService.GetString("SharpDbTools.Forms.InvariantNameNodeName") + invariantName; - attributesNode.Nodes.Add(invNameNode); - } - - return attributesNode; - } - - private TreeNode CreateMetaDataNode(string name) - { - LoggingService.Debug("creating metadata tree for connection with name: " + name); - TreeNode node = null; - // get the invariant name from the name, then get the FormsArtefactFactory - DbModelInfo modelInfo = DbModelInfoService.GetDbModelInfo(name); - - if (modelInfo == null) { - LoggingService.Error("could not find a logical connection named: " + name); - throw new ArgumentException("this logical connection name is not defined: " + name); - } - - string invariantName = modelInfo.InvariantName; - LoggingService.Debug("got invariant name: " + invariantName + " for connection name: " + name); - - try { - LoggingService.Debug(this.GetType().ToString() - + ": getting forms info for name: " - + name + " and invariant name: " - + invariantName); - FormsArtefactFactory factory = FormsArtefactFactories.GetFactory(invariantName); - node = factory.CreateMetaDataNode(name); - } catch(ArgumentException e) { - LoggingService.Debug(this.GetType().ToString() - + " failed to create metadata node for connection: " - + name + "\n" - + e.Message + "\n" - + e.GetType().ToString()); - node = new TreeNode("No Metadata"); - } - return node; - } - - /// - /// Uses a dialog to get the logical name of a new Connection then - /// adds a new DbModelInfo for it to the cache and updates the DatabaseServer - /// Tree. - /// - /// - /// - - private void SetConnectionStringOnDbModelInfoClickHandler(object sender, EventArgs e) - { - string connectionLogicalName = (string)this.Tag; - LoggingService.Debug("add connection string clicked for item with name: " + connectionLogicalName); - - // use the ConnectionStringDefinitionDialog to get a connection string and invariant name - ConnectionStringDefinitionDialog definitionDialog = new ConnectionStringDefinitionDialog(); - DialogResult result = definitionDialog.ShowDialog(); - - // if the dialog was cancelled then do nothing - if (result == DialogResult.Cancel) { - return; - } - - // if the dialog was submitted and connection string has changed then clear the DbModelInfo metadata - // note that is is not required for the Connection string to be valid - it may be work - // in progress and a user might want to save a partially formed connection string - - DbModelInfo dbModelInfo = DbModelInfoService.GetDbModelInfo(connectionLogicalName); - string connectionString = dbModelInfo.ConnectionString; - string newConnectionString = definitionDialog.ConnectionString; - - if (newConnectionString == null) { - return; - } - - dbModelInfo.ConnectionString = newConnectionString; - dbModelInfo.InvariantName = definitionDialog.InvariantName; - - // rebuild the database explorer node - this.FireRebuildRequired(); - } - - private void LoadMetadataFromFileClickHandler(object sender, EventArgs e) - { - LoggingService.Debug("load metadata from file clicked"); - this.backgroundWorker = new BackgroundWorker(); - backgroundWorker.DoWork += new DoWorkEventHandler(this.LoadMetadataFromFileDoWork); - backgroundWorker.RunWorkerCompleted += - new RunWorkerCompletedEventHandler(this.LoadMetadataFinished); - string logicalConnectionName = (string)this.Tag; - this.message = logicalConnectionName + fileLoadMessage; - this.ContextMenuStrip.Enabled = false; - timer.Start(); - this.backgroundWorker.RunWorkerAsync(logicalConnectionName); - } - - private void OpenSQLToolClickHandler(object sender, EventArgs e) - { - SQLToolViewContent sqlToolViewContent = new SQLToolViewContent((string)this.Tag); - WorkbenchSingleton.Workbench.ShowView(sqlToolViewContent); - } - - private void TimerClick(object sender, EventArgs eventArgs) - { - string ellipsis = progress.Text; - progress.performStep(); - string displayMsg = this.message + ellipsis; - SetText(displayMsg); - - } - - delegate void TextSetterDelegate(string text); - - public void SetText(string text) - { - if (this.TreeView.InvokeRequired) { - this.TreeView.Invoke(new TextSetterDelegate(this.SetText), new object[] { text }); - return; - } - this.Text = text; - } - - private void LoadMetadataFromFileDoWork(object sender, DoWorkEventArgs args) - { - string logicalConnectionName = args.Argument as string; - if (logicalConnectionName != null) { - DbModelInfoService.LoadFromFile(logicalConnectionName); - } - } - - private void LoadMetadataFinished(object sender, RunWorkerCompletedEventArgs args) - { - if (this.TreeView.InvokeRequired) { - this.TreeView.Invoke(new EventHandler - (this.LoadMetadataFinished)); - return; - } - this.timer.Stop(); - this.Text = (string)this.Tag; - this.ContextMenuStrip.Enabled = true; - this.backgroundWorker.Dispose(); - this.backgroundWorker = null; - this.FireRebuildRequired(); - } - - private void LoadMetadataFromConnectionClickHandler(object sender, EventArgs args) - { - LoggingService.Debug("load metadata from connection clicked"); - this.backgroundWorker = new BackgroundWorker(); - backgroundWorker.DoWork += new DoWorkEventHandler(this.LoadMetadataFromConnectionDoWork); - backgroundWorker.RunWorkerCompleted += - new RunWorkerCompletedEventHandler(this.LoadMetadataFinished); - string logicalConnectionName = (string)this.Tag; - this.message = logicalConnectionName + connectionLoadMessage; - this.ContextMenuStrip.Enabled = false; - timer.Start(); - this.backgroundWorker.RunWorkerAsync(logicalConnectionName); - } - - private void LoadMetadataFromConnectionDoWork(object sender, DoWorkEventArgs args) - { - string connectionLogicalName = args.Argument as string; - if (connectionLogicalName != null) { - try { - DbModelInfoService.LoadMetadataFromConnection(connectionLogicalName); - } - catch(DbException e) { - MessageService.ShowError(e, - "An Exception was thrown while trying to connect to: " + connectionLogicalName); - } - } - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/FormsArtefactFactories.cs b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/FormsArtefactFactories.cs deleted file mode 100644 index 2ca6fe1bb6..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/FormsArtefactFactories.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Collections.Generic; -using ICSharpCode.Core; - -namespace SharpDbTools.Forms -{ - /// - /// Description of FormsArtefactFactories. - /// - public static class FormsArtefactFactories - { - public const string FORMS_ARTEFACT_FACTORIES_PATH = "/SharpServerTools/SharpDbTools/FormsArtefactFactory"; - public static Dictionary factories = new Dictionary(); - - static FormsArtefactFactories() - { - AddInTreeNode node = - AddInTree.GetTreeNode(FORMS_ARTEFACT_FACTORIES_PATH); - List codons = node.Codons; - foreach (Codon codon in codons) { - // create an instance of the relevant FormsArtefactFactory indexed by invariant name - string invariant = codon.Id; - FormsArtefactFactory factory = (FormsArtefactFactory)node.BuildChildItem(invariant, null, null); - factories.Add(invariant, factory); - } - } - - public static FormsArtefactFactory GetFactory(string invariantName) - { - LoggingService.Debug("Looking for FormsArtefactFactory for: " + invariantName); - - // to test this base it on hardcoded strings for the type of the factory - - // TODO: drive this from the AddIn tree - - FormsArtefactFactory factory = null; - factories.TryGetValue(invariantName, out factory); - if (factory == null) { - throw new ArgumentException("No FormsArtefactFactory found for InvariantName: " - + invariantName); - } - return factory; - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/FormsArtefactFactory.cs b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/FormsArtefactFactory.cs deleted file mode 100644 index bbd9453d34..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/FormsArtefactFactory.cs +++ /dev/null @@ -1,32 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Windows.Forms; -using ICSharpCode.Core; - -namespace SharpDbTools.Forms -{ - /// - /// Base class for one of the classes that each SharpDbTools plugin must support. Subclasses - /// provide the UI artefacts required to build the metadata node for a particular - /// datasource such as Oracle, SQLServer, MySQL etc. - /// It makes sense to have a separate derived class for each datasource since the structure and - /// relationship of db objects supported by each server is quite different, and therefore merits - /// quite a different presentation and layout in the metadata tree. - /// - public abstract class FormsArtefactFactory - { - public FormsArtefactFactory() - { - } - - public abstract TreeNode CreateMetaDataNode(string name); - public abstract string[] GetDescribeTableFieldNames(); - public abstract string[] GetDescribeTableColumnHeaderNames(); - } -} diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.Designer.cs b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.Designer.cs deleted file mode 100644 index 6d4200c2d3..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.Designer.cs +++ /dev/null @@ -1,167 +0,0 @@ -/* - * User: dickon - * Date: 21/11/2006 - * Time: 19:12 - * - */ -namespace SharpDbTools.Forms -{ - partial class SQLTool : System.Windows.Forms.UserControl - { - /// - /// Designer variable used to keep track of non-visual components. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Disposes resources used by the control. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing) { - if (components != null) { - components.Dispose(); - } - } - - /// - base.Dispose(disposing); - } - /// This method is required for Windows Forms designer support. - /// Do not change the method contents inside the source code editor. The Forms designer might - /// not be able to load this method if it was changed manually. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.sqlToolTabControl = new System.Windows.Forms.TabControl(); - this.editorTab = new System.Windows.Forms.TabPage(); - this.statusStrip = new System.Windows.Forms.StatusStrip(); - this.queryToolStripProgressBar = new System.Windows.Forms.ToolStripProgressBar(); - this.resultTab = new System.Windows.Forms.TabPage(); - this.resultDataGridView = new System.Windows.Forms.DataGridView(); - this.messageTab = new System.Windows.Forms.TabPage(); - this.messageTextBox = new System.Windows.Forms.TextBox(); - this.progressTimer = new System.Windows.Forms.Timer(this.components); - this.sqlToolTabControl.SuspendLayout(); - this.editorTab.SuspendLayout(); - this.statusStrip.SuspendLayout(); - this.resultTab.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.resultDataGridView)).BeginInit(); - this.messageTab.SuspendLayout(); - this.SuspendLayout(); - // - // sqlToolTabControl - // - this.sqlToolTabControl.Controls.Add(this.editorTab); - this.sqlToolTabControl.Controls.Add(this.resultTab); - this.sqlToolTabControl.Controls.Add(this.messageTab); - this.sqlToolTabControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.sqlToolTabControl.Location = new System.Drawing.Point(0, 0); - this.sqlToolTabControl.Name = "sqlToolTabControl"; - this.sqlToolTabControl.SelectedIndex = 0; - this.sqlToolTabControl.Size = new System.Drawing.Size(759, 452); - this.sqlToolTabControl.TabIndex = 0; - // - // editorTab - // - this.editorTab.Controls.Add(this.statusStrip); - this.editorTab.Location = new System.Drawing.Point(4, 22); - this.editorTab.Name = "editorTab"; - this.editorTab.Padding = new System.Windows.Forms.Padding(3); - this.editorTab.Size = new System.Drawing.Size(751, 426); - this.editorTab.TabIndex = 0; - this.editorTab.Text = "Editor"; - this.editorTab.UseVisualStyleBackColor = true; - // - // statusStrip - // - this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.queryToolStripProgressBar}); - this.statusStrip.Location = new System.Drawing.Point(3, 401); - this.statusStrip.Name = "statusStrip"; - this.statusStrip.Size = new System.Drawing.Size(745, 22); - this.statusStrip.TabIndex = 0; - this.statusStrip.Text = "statusStrip1"; - // - // queryToolStripProgressBar - // - this.queryToolStripProgressBar.Name = "queryToolStripProgressBar"; - this.queryToolStripProgressBar.Size = new System.Drawing.Size(100, 16); - this.queryToolStripProgressBar.Visible = false; - // - // resultTab - // - this.resultTab.Controls.Add(this.resultDataGridView); - this.resultTab.Location = new System.Drawing.Point(4, 22); - this.resultTab.Name = "resultTab"; - this.resultTab.Padding = new System.Windows.Forms.Padding(3); - this.resultTab.Size = new System.Drawing.Size(751, 426); - this.resultTab.TabIndex = 1; - this.resultTab.Text = "Results"; - this.resultTab.UseVisualStyleBackColor = true; - // - // resultDataGridView - // - this.resultDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.resultDataGridView.Dock = System.Windows.Forms.DockStyle.Fill; - this.resultDataGridView.Location = new System.Drawing.Point(3, 3); - this.resultDataGridView.Name = "resultDataGridView"; - this.resultDataGridView.Size = new System.Drawing.Size(745, 420); - this.resultDataGridView.TabIndex = 0; - // - // messageTab - // - this.messageTab.Controls.Add(this.messageTextBox); - this.messageTab.Location = new System.Drawing.Point(4, 22); - this.messageTab.Name = "messageTab"; - this.messageTab.Padding = new System.Windows.Forms.Padding(3); - this.messageTab.Size = new System.Drawing.Size(751, 426); - this.messageTab.TabIndex = 2; - this.messageTab.Text = "Messages"; - this.messageTab.UseVisualStyleBackColor = true; - // - // messageTextBox - // - this.messageTextBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.messageTextBox.Location = new System.Drawing.Point(3, 3); - this.messageTextBox.Multiline = true; - this.messageTextBox.Name = "messageTextBox"; - this.messageTextBox.Size = new System.Drawing.Size(745, 420); - this.messageTextBox.TabIndex = 0; - // - // progressTimer - // - this.progressTimer.Tick += new System.EventHandler(this.ProgressTimerTick); - // - // SQLTool - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.sqlToolTabControl); - this.Name = "SQLTool"; - this.Size = new System.Drawing.Size(759, 452); - this.sqlToolTabControl.ResumeLayout(false); - this.editorTab.ResumeLayout(false); - this.editorTab.PerformLayout(); - this.statusStrip.ResumeLayout(false); - this.statusStrip.PerformLayout(); - this.resultTab.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.resultDataGridView)).EndInit(); - this.messageTab.ResumeLayout(false); - this.messageTab.PerformLayout(); - this.ResumeLayout(false); - } - private System.Windows.Forms.Timer progressTimer; - private System.Windows.Forms.ToolStripProgressBar queryToolStripProgressBar; - private System.Windows.Forms.StatusStrip statusStrip; - private System.Windows.Forms.TextBox messageTextBox; - private System.Windows.Forms.DataGridView resultDataGridView; - private System.Windows.Forms.TabControl sqlToolTabControl; - private System.Windows.Forms.TabPage messageTab; - private System.Windows.Forms.TabPage resultTab; - private System.Windows.Forms.TabPage editorTab; - - } -} diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.cs b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.cs deleted file mode 100644 index d2fbcee725..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.cs +++ /dev/null @@ -1,215 +0,0 @@ -/* - * User: dickon - * Contributions from: troy@ebswift.com - * Date: 21/11/2006 - * Time: 19:12 - * - */ - -using System; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; -using System.IO; -using System.Data.Common; -using System.Data; - -using ICSharpCode.TextEditor; -using ICSharpCode.Core; - -using SharpDbTools.Data; -using SharpDbTools.Forms.TextEditor; - -namespace SharpDbTools.Forms -{ - /// - /// A generic sql query tool utilising the #D TextEditor and SharpDbTools DbModelInfo framework - /// for metadata management - /// - public partial class SQLTool - { - private string logicalConnectionName = null; - private SQLTextEditorControl sqlEditorControl = null; - private BackgroundWorker backgroundWorker; - private string lastSQL; - - public SQLTool(string logicalConnectionName) - { - this.logicalConnectionName = logicalConnectionName; - - // - // The InitializeComponent() call is required for Windows Forms designer support. - // - InitializeComponent(); - - // add sqlEditor to the editor panel - - sqlEditorControl = new SQLTextEditorControl(); - sqlEditorControl.Dock = DockStyle.Fill; - - // set up the highlighting manager for generic SQL - - string appPath = Path.GetDirectoryName(Application.ExecutablePath); - SQLToolResourceSyntaxModeProvider provider = new SQLToolResourceSyntaxModeProvider(); - ICSharpCode.TextEditor.Document.HighlightingManager.Manager.AddSyntaxModeFileProvider(provider); - // this loads the SQL.xshd file that is compiled as a resource - written by Troy@ebswift.com - sqlEditorControl.Document.HighlightingStrategy = - ICSharpCode.TextEditor.Document.HighlightingManager.Manager.FindHighlighter("SQL"); - - // setup the SQLTool in the tab control - - this.editorTab.Controls.Add(sqlEditorControl); - - // add context behaviour to the editor control - - ContextMenuStrip contextMenu = new ContextMenuStrip(); - - ToolStripMenuItem runSQLMenuItem = new ToolStripMenuItem("Run SQL"); - runSQLMenuItem.Click += new EventHandler(RunSQLClickHandler); - - contextMenu.Items.AddRange(new ToolStripMenuItem[] - { - runSQLMenuItem - }); - sqlEditorControl.ContextMenuStrip = contextMenu; - } - - private void RunSQLClickHandler(object sender, EventArgs args) - { - // 1. get a connection from the the logical connection name - // 2. attempt to execute any SQL currently contained in the editor - // 3. display either a result set in the result DataGridView, or - // messages in the messages textbox in the message tab. - LoggingService.Debug(this.GetType().Name + "-> RunSQLClickHandler"); - this.lastSQL = this.sqlEditorControl.Document.TextContent; - this.backgroundWorker = new BackgroundWorker(); - backgroundWorker.DoWork += DispatchSQL; - backgroundWorker.RunWorkerCompleted += DispatchSQLComplete; - backgroundWorker.RunWorkerAsync(); - } - - private void DispatchSQL(object sender, DoWorkEventArgs e) - { - // use the logical connection name to map to the invariant name - // in the DbModelInfoService - DbModelInfo modelInfo = DbModelInfoService.GetDbModelInfo(this.logicalConnectionName); - string invariantName = modelInfo.InvariantName; - - // use the invariant name to get the DbProviderFactory from the DBProvidersService - DbProvidersService dbProvidersService = DbProvidersService.GetDbProvidersService(); - DbProviderFactory factory = dbProvidersService.GetFactoryByInvariantName(invariantName); - - // get a connection from the DbProviderFactory - DbConnection connection = factory.CreateConnection(); - - // use the logical connection name to map to the connection string - // for this connection in the DbModelInfoService - string connectionString = modelInfo.ConnectionString; - connection.ConnectionString = connectionString; - - - try { - // dispatch the sql on this connection - // if result is successful invoke an update to the DataGridView of - // SQLTool - connection.Open(); - DbCommand command = connection.CreateCommand(); - LoggingService.Debug("getting sql command"); - command.CommandText = this.lastSQL; - LoggingService.Debug("dispatching sql: " + command.CommandText); - DispatchSQLStarting(); - DbDataReader reader = command.ExecuteReader(); - LoggingService.Debug("received ResultSet, showing in SQLTool..."); - this.SetDataGridViewContent(reader); - } - catch(Exception ex) { - // if the result is unsuccessful invoke an update to the message - // view of SQLTool hopefully with the reason for the failure - string msg = "caught exception: " + ex.GetType().Name - + ": " + ex.Message; - LoggingService.Debug(msg); - LoggingService.Debug(ex.StackTrace); - this.AppendMessageContent(msg); - } - finally { - connection.Close(); - connection.Dispose(); - } - } - - delegate void AppendMessageContentCallback(string msg); - - private void AppendMessageContent(string msg) - { - if (this.messageTextBox.InvokeRequired) { - AppendMessageContentCallback c = new AppendMessageContentCallback(AppendMessageContent); - this.Invoke(c, new object[] { msg }); - } else { -// string currentText = this.messageTextBox.Text; -// this.messageTextBox.Clear; -// // Font font = this.messageTextBox.Font; -// // redisplay currentText using a modified Font with grey colour -// // then reset Font back to original -// // TODO: implement Font colour changes - this.messageTextBox.AppendText(msg); - this.messageTextBox.AppendText("\n"); - this.sqlToolTabControl.SelectTab(this.messageTab); - } - } - - delegate void SetDataGridViewContentCallback(DbDataReader reader); - - private void SetDataGridViewContent(DbDataReader reader) - { - if (this.resultDataGridView.InvokeRequired) { - SetDataGridViewContentCallback c = new SetDataGridViewContentCallback(SetDataGridViewContent); - this.Invoke(c, new object[] { reader }); - } else { - string tableName = reader.GetSchemaTable().TableName; - this.resultDataGridView.ClearSelection(); - DataTable data = new DataTable(); - data.BeginInit(); - data.Load(reader); - data.EndInit(); - this.resultDataGridView.DataSource = data; - this.sqlToolTabControl.SelectTab(this.resultTab); - } - } - - private void DispatchSQLStarting() - { - if (this.InvokeRequired) { - MethodInvoker c = new MethodInvoker(DispatchSQLStarting); - this.Invoke(c, new object[] {}); - } else { - this.queryToolStripProgressBar.Visible = true; - this.progressTimer.Enabled = true; - } - } - - void ProgressTimerTick(object sender, System.EventArgs e) - { - // insert calls under Invoke to doPerform on statusStrip.progressBar - if (this.InvokeRequired) { - EventHandler handler = new EventHandler(ProgressTimerTick); - this.Invoke(handler, new object[] {sender, e}); - } else { - if (this.queryToolStripProgressBar.Value >= this.queryToolStripProgressBar.Maximum) - this.queryToolStripProgressBar.Value = 0; - this.queryToolStripProgressBar.PerformStep(); - } - - } - - public void DispatchSQLComplete(object sender, RunWorkerCompletedEventArgs args) - { - if (this.InvokeRequired) { - RunWorkerCompletedEventHandler c = new RunWorkerCompletedEventHandler(DispatchSQLComplete); - this.Invoke(c, new object[] {sender, args}); - } else { - this.progressTimer.Enabled = false; - this.queryToolStripProgressBar.Visible = false; - } - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.resx b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.resx deleted file mode 100644 index 288433e347..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 122, 17 - - \ No newline at end of file diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLToolResourceSyntaxModeProvider.cs b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLToolResourceSyntaxModeProvider.cs deleted file mode 100644 index 3cbab7b7e2..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLToolResourceSyntaxModeProvider.cs +++ /dev/null @@ -1,54 +0,0 @@ -/* - * User: dickon - * Date: 06/12/2006 - * Time: 12:53 - * - */ - -using System; -using System.Collections.Generic; -using System.Xml; -using System.Reflection; -using System.IO; - -using ICSharpCode.TextEditor.Document; - -namespace SharpDbTools.Forms -{ - /// - /// Implementation specifically for SQLTool, based on - /// a copy-and-paste reuse of ICSharpCode.TextEditor.ResourceSyntaxModeProvider - /// - public class SQLToolResourceSyntaxModeProvider: ISyntaxModeFileProvider - { - List syntaxModes = null; - - public ICollection SyntaxModes { - get { - return syntaxModes; - } - } - - public SQLToolResourceSyntaxModeProvider() - { - Assembly assembly = this.GetType().Assembly; - Stream syntaxModeStream = assembly.GetManifestResourceStream("SharpDbTools.Resources.SyntaxModes.xml"); - if (syntaxModeStream != null) { - syntaxModes = SyntaxMode.GetSyntaxModes(syntaxModeStream); - } else { - syntaxModes = new List(); - } - } - - public XmlTextReader GetSyntaxModeFile(SyntaxMode syntaxMode) - { - Assembly assembly = this.GetType().Assembly; - return new XmlTextReader(assembly.GetManifestResourceStream("SharpDbTools.Resources." + syntaxMode.FileName)); - } - - public void UpdateSyntaxModeList() - { - // resources don't change during runtime - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLToolViewContent.cs b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLToolViewContent.cs deleted file mode 100644 index 2f5938d04a..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLToolViewContent.cs +++ /dev/null @@ -1,49 +0,0 @@ -/* - * User: dickon - * Date: 21/11/2006 - * Time: 22:46 - * - */ - -using System; -using System.Data; -using System.Windows.Forms; - -using ICSharpCode.SharpDevelop.Gui; - -namespace SharpDbTools.Forms -{ - /// - /// Description of SQLEditorQueryToolViewContent. - /// - public class SQLToolViewContent : AbstractViewContent - { - string logicalConnectionName; - SQLTool sqlTool; - - public SQLToolViewContent(string logicalConnectionName) - { - this.TitleName = "SQL Tool: " + logicalConnectionName; - this.logicalConnectionName = logicalConnectionName; - sqlTool = new SQLTool(this.logicalConnectionName); - } - - public override System.Windows.Forms.Control Control { - get { - return this.sqlTool; - } - } - - public override bool IsReadOnly { - get { - return false; - } - } - - public override bool IsViewOnly { - get { - return false; - } - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/TableDescribeViewContent.cs b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/TableDescribeViewContent.cs deleted file mode 100644 index b71f88d813..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/TableDescribeViewContent.cs +++ /dev/null @@ -1,72 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Data; -using System.Windows.Forms; - -using ICSharpCode.SharpDevelop.Gui; - -namespace SharpDbTools.Forms -{ - /// - /// Description of TableDescribeViewContent. - /// - public class TableDescribeViewContent : AbstractViewContent - { - DataTable tableInfo; - DataGridView tableInfoDataGridView; - - - public TableDescribeViewContent(DataTable tableInfo, - string tableName, - string[] fieldsToDisplay, - string[] columnHeaderNames) - { - this.TitleName = "table: " + tableName; - this.tableInfo = tableInfo; - this.tableInfoDataGridView = new DataGridView(); - DataGridView v = this.tableInfoDataGridView; - - v.AutoGenerateColumns = false; - v.AutoSize = true; - - v.DataSource = this.tableInfo; - //v.DataMember = TableNames.Columns; - - for (int i = 0; i < fieldsToDisplay.Length; i++ ) { - DataGridViewColumn c = new DataGridViewTextBoxColumn(); - c.DataPropertyName = fieldsToDisplay[i]; - c.Name = columnHeaderNames[i]; - v.Columns.Add(c); - } - v.AllowUserToAddRows = false; - v.AllowUserToDeleteRows = false; - v.AllowUserToResizeRows = false; - v.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells; - v.AutoResizeColumns(); - } - - public override System.Windows.Forms.Control Control { - get { - return this.tableInfoDataGridView; - } - } - - public override bool IsReadOnly { - get { - return true; - } - } - - public override bool IsViewOnly { - get { - return true; - } - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/TableTreeNode.cs b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/TableTreeNode.cs deleted file mode 100644 index 44e99cf972..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/TableTreeNode.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Data; -using System.Windows.Forms; - -using ICSharpCode.Core; -using ICSharpCode.SharpDevelop.Gui; -using SharpDbTools.Data; -using SharpServerTools.Forms; - -namespace SharpDbTools.Forms -{ - /// - /// specialisation of the TreeNode to add context menu and click handling - /// to invoke the DescribeTable component for Oracle tables. - /// - - public class TableTreeNode: TreeNode - { - string logicalConnectionName; - - public TableTreeNode(string objectName, string logicalConnectionName): base(objectName) - { - this.logicalConnectionName = logicalConnectionName; - NodeAwareContextMenuStrip cMenu = new NodeAwareContextMenuStrip(this); - - ToolStripMenuItem invokeDescriberMenuItem = new ToolStripMenuItem("Describe"); - invokeDescriberMenuItem.Click += new EventHandler(DescribeTableClickHandler); - - - - cMenu.Items.AddRange(new ToolStripMenuItem[] - { - invokeDescriberMenuItem - }); - this.ContextMenuStrip = cMenu; - } - - public void DescribeTableClickHandler(object sender, EventArgs args) - { - ToolStripMenuItem item = sender as ToolStripMenuItem; - NodeAwareContextMenuStrip s = item.Owner as NodeAwareContextMenuStrip; - string tableName = s.TreeNode.Text; - LoggingService.Debug("describe table clicked for: " + logicalConnectionName + " and table name: " + tableName); - DataTable tableInfo = DbModelInfoService.GetTableInfo(logicalConnectionName, tableName); - string invariantName = DbModelInfoService.GetDbModelInfo(logicalConnectionName).InvariantName; - // TODO: get field names and column header names from factory - FormsArtefactFactory factory = FormsArtefactFactories.GetFactory(invariantName); - - TableDescribeViewContent tableDescribeViewContent = - new TableDescribeViewContent(tableInfo, tableName, factory.GetDescribeTableFieldNames(), - factory.GetDescribeTableColumnHeaderNames()); - WorkbenchSingleton.Workbench.ShowView(tableDescribeViewContent); - } - } -} diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Provider/OracleFormsArtefactFactory.cs b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Provider/OracleFormsArtefactFactory.cs deleted file mode 100644 index 18daef6638..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Provider/OracleFormsArtefactFactory.cs +++ /dev/null @@ -1,107 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Data; -using System.Windows.Forms; - -using ICSharpCode.Core; -using SharpDbTools.Data; -using SharpDbTools.Forms; - -namespace SharpDbTools.Oracle.Forms -{ - /// - /// Description of MetaDataNodeBuilder. - /// TODO: currently this is just a flat list - need to reflect ownership - /// relationships such as schema etc - /// - public class OracleFormsArtefactFactory : FormsArtefactFactory - { - public OracleFormsArtefactFactory() - { - } - - public override TreeNode CreateMetaDataNode(string logicalConnectionName) - { - LoggingService.Debug(this.GetType().ToString() - + ": creating MetaDataNode for: " + logicalConnectionName); - // create root node of the metadata collections tree - - string nodeName = ResourceService.GetString("SharpDbTools.Forms.DbObjectNodeName"); - TreeNode metaNode = new TreeNode(nodeName); - - // retrieve the metadata for this logical connection name - - DbModelInfo info = DbModelInfoService.GetDbModelInfo(logicalConnectionName); - - // retrieve the table listing the metadata collections - - DataTable metadataCollectionsTable = info.Tables[MetadataNames.MetaDataCollections]; - - // if it exists then populate the tree - - if (metadataCollectionsTable != null) { - LoggingService.Debug(this.GetType().ToString() + ": found metadata collections table, " + - " building node..."); - for (int i = 0; i < MetadataNames.PrimaryObjects.Length; i++) { - string metadataCollectionName = MetadataNames.PrimaryObjects[i]; - LoggingService.Debug("looking for metadata: " + metadataCollectionName); - DataTable metaCollectionTable = info.Tables[metadataCollectionName]; - if (metaCollectionTable == null) continue; - LoggingService.Debug("found metadata collection: " + metadataCollectionName); - string nodeDisplayNameKey = "SharpDbTools.Data.PrimaryObjects." + metadataCollectionName; - string nodeDisplayName = ResourceService.GetString(nodeDisplayNameKey); - TreeNode collectionNode = new TreeNode(nodeDisplayName); - collectionNode.Name = logicalConnectionName + ":Collection:" + metadataCollectionName; - metaNode.Nodes.Add(collectionNode); - foreach (DataRow dbObjectRow in metaCollectionTable.Rows) { - TreeNode objectNode = null; - switch(metadataCollectionName) { - case "Tables": - //LoggingService.Debug("found table row"); - objectNode = new TableTreeNode((string)dbObjectRow[1], logicalConnectionName); - break; - case "Users": - //LoggingService.Debug("found users row"); - objectNode = new TreeNode((string)dbObjectRow[0]); - break; - default: - //LoggingService.Debug("found " + metadataCollectionName + " row"); - if (dbObjectRow.ItemArray.Length > 1) { - objectNode = new TreeNode((string)dbObjectRow[1]); - } else { - objectNode = new TreeNode((string)dbObjectRow[0]); - } - break; - } - collectionNode.Nodes.Add(objectNode); - } - } - } - return metaNode; - } - - public override string[] GetDescribeTableFieldNames() - { - return tableFieldsToDisplay; - } - public override string[] GetDescribeTableColumnHeaderNames() - { - return tableFieldsColumnHeaders; - } - - private static string[] tableFieldsToDisplay = - new string [] {"COLUMN_NAME", "DATATYPE", - "LENGTH", "PRECISION", "SCALE", "NULLABLE"}; - private static string[] tableFieldsColumnHeaders = - new string[] { "Column", "Type", "Length", "Precision", "Scale", "Nullable" }; - - - } - -} diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Provider/SQLServerFormsArtefactFactory.cs b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Provider/SQLServerFormsArtefactFactory.cs deleted file mode 100644 index e1a7f59d3d..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Provider/SQLServerFormsArtefactFactory.cs +++ /dev/null @@ -1,123 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Data; -using System.Windows.Forms; - -using ICSharpCode.Core; -using SharpDbTools.Data; -using SharpDbTools.Forms; - -namespace SharpDbTools.SQLServer.Forms -{ - /// - /// Creates a TreeNode that displays the metadata for a SQLServer database - /// Uses: - /// DbModelInfo and DbModelInfoService: to access the metadata - /// TableTreeNode: to display Table metadata - this has 'Describe' - /// behaviour associated with it, accessed via a right mouse menu - /// Going forward this should reflect the structure and relationship - /// of SQLServer objects - for now it is generic - /// - public class SQLServerFormsArtefactFactory : FormsArtefactFactory - { - public SQLServerFormsArtefactFactory() - { - } - - public override TreeNode CreateMetaDataNode(string logicalConnectionName) - { - LoggingService.Debug(this.GetType().ToString() - + ": creating MetaDataNode for: " + logicalConnectionName); - // create root node of the metadata collections tree - - string nodeName = ResourceService.GetString("SharpDbTools.Forms.DbObjectNodeName"); - TreeNode metaNode = new TreeNode(nodeName); - - // retrieve the metadata for this logical connection name - - DbModelInfo info = DbModelInfoService.GetDbModelInfo(logicalConnectionName); - - // retrieve the table listing the metadata collections - - DataTable metadataCollectionsTable = info.Tables[MetadataNames.MetaDataCollections]; - - // if it exists then populate the tree - - if (metadataCollectionsTable != null) { - LoggingService.Debug(this.GetType().ToString() + ": found metadata collections table, " + - " building node..."); - for (int i = 0; i < MetadataNames.PrimaryObjects.Length; i++) { - string metadataCollectionName = MetadataNames.PrimaryObjects[i]; - LoggingService.Debug("looking for metadata: " + metadataCollectionName); - DataTable metaCollectionTable = info.Tables[metadataCollectionName]; - if (metaCollectionTable == null) continue; - LoggingService.Debug("found metadata collection: " + metadataCollectionName); - string nodeDisplayNameKey = "SharpDbTools.Data.PrimaryObjects." + metadataCollectionName; - string nodeDisplayName = ResourceService.GetString(nodeDisplayNameKey); - TreeNode collectionNode = new TreeNode(nodeDisplayName); - metaNode.Nodes.Add(collectionNode); - - if (metaCollectionTable != null) { - foreach (DataRow dbObjectRow in metaCollectionTable.Rows) { - TreeNode objectNode = null; - - // if there is only one field in the metadata table then it is almost certainly - // the name of the item - so if not we need to then figure out what it is - if (dbObjectRow.ItemArray.Length > 1) { - - // if it is a table metadata collection then create a node - // with the option to invoke the DescribeTableViewContent - - // that's what a TableTreeNode gives us right now - // TODO: provide describe functions amongst others for - // other metadata types - - switch (metadataCollectionName) { - case "Tables": - objectNode = new TableTreeNode((string)dbObjectRow[2], logicalConnectionName); - break; - case "Functions": - // do nothing - there are no functions in SQLServer - break; - case "Users": - objectNode = new TreeNode((string)dbObjectRow[1]); - break; - default: - objectNode = new TreeNode((string)dbObjectRow[2]); - break; - } - } else { - objectNode = new TreeNode((string)dbObjectRow[0]); - } - collectionNode.Nodes.Add(objectNode); - } - } - } - } - return metaNode; - } - - public override string[] GetDescribeTableFieldNames() - { - return tableFieldsToDisplay; - } - public override string[] GetDescribeTableColumnHeaderNames() - { - return tableFieldsColumnHeaders; - } - - private static string[] tableFieldsToDisplay = - new string [] {"COLUMN_NAME", "DATA_TYPE", - "CHARACTER_OCTET_LENGTH", "NUMERIC_PRECISION", "NUMERIC_SCALE", "IS_NULLABLE"}; - private static string[] tableFieldsColumnHeaders = - new string[] { "Column", "Type", "Length", "Precision", "Scale", "Nullable" }; - - - } - -} diff --git a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Provider/SQLiteArtefactFactory.cs b/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Provider/SQLiteArtefactFactory.cs deleted file mode 100644 index ff04f492ee..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Provider/SQLiteArtefactFactory.cs +++ /dev/null @@ -1,98 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.Data; -using System.Windows.Forms; - -using ICSharpCode.Core; -using SharpDbTools.Data; -using SharpDbTools.Forms; - -namespace SharpDbTools.SQLite.Forms -{ - /// - /// Description of MetaDataNodeBuilder. - /// TODO: currently this is just a flat list - need to reflect ownership - /// relationships such as schema etc - /// - public class SQLiteFormsArtefactFactory : FormsArtefactFactory - { - public SQLiteFormsArtefactFactory() - { - } - - public override TreeNode CreateMetaDataNode(string logicalConnectionName) - { - LoggingService.Debug(this.GetType().ToString() - + ": creating MetaDataNode for: " + logicalConnectionName); - // create root node of the metadata collections tree - - string nodeName = ResourceService.GetString("SharpDbTools.Forms.DbObjectNodeName"); - TreeNode metaNode = new TreeNode(nodeName); - - // retrieve the metadata for this logical connection name - - DbModelInfo info = DbModelInfoService.GetDbModelInfo(logicalConnectionName); - - // retrieve the table listing the metadata collections - - DataTable metadataCollectionsTable = info.Tables[MetadataNames.MetaDataCollections]; - - // if it exists then populate the tree - - if (metadataCollectionsTable != null) { - LoggingService.Debug(this.GetType().ToString() + ": found metadata collections table, " + - " building node..."); - for (int i = 0; i < MetadataNames.PrimaryObjects.Length; i++) { - string metadataCollectionName = MetadataNames.PrimaryObjects[i]; - LoggingService.Debug("looking for metadata: " + metadataCollectionName); - DataTable metaCollectionTable = info.Tables[metadataCollectionName]; - if (metaCollectionTable == null) continue; - LoggingService.Debug("found metadata collection: " + metadataCollectionName); - string nodeDisplayNameKey = "SharpDbTools.Data.PrimaryObjects." + metadataCollectionName; - string nodeDisplayName = ResourceService.GetString(nodeDisplayNameKey); - TreeNode collectionNode = new TreeNode(nodeDisplayName); - collectionNode.Name = logicalConnectionName + ":Collection:" + metadataCollectionName; - metaNode.Nodes.Add(collectionNode); - foreach (DataRow dbObjectRow in metaCollectionTable.Rows) { - TreeNode objectNode = null; - switch(metadataCollectionName) { - case "Tables": - //LoggingService.Debug("found table row"); - objectNode = new TableTreeNode((string)dbObjectRow[2], logicalConnectionName); - break; - default: - objectNode = new TreeNode((string)dbObjectRow[2]); - break; - } - collectionNode.Nodes.Add(objectNode); - } - } - } - return metaNode; - } - - public override string[] GetDescribeTableFieldNames() - { - return tableFieldsToDisplay; - } - public override string[] GetDescribeTableColumnHeaderNames() - { - return tableFieldsColumnHeaders; - } - - private static string[] tableFieldsToDisplay = - new string [] {"COLUMN_NAME", "DATATYPE", - "LENGTH", "PRECISION", "SCALE", "NULLABLE"}; - private static string[] tableFieldsColumnHeaders = - new string[] { "Column", "Type", "Length", "Precision", "Scale", "Nullable" }; - - - } - -} diff --git a/src/AddIns/Misc/SharpServerTools/SharpServerTools.addin b/src/AddIns/Misc/SharpServerTools/SharpServerTools.addin deleted file mode 100644 index 48a5b7bd66..0000000000 --- a/src/AddIns/Misc/SharpServerTools/SharpServerTools.addin +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - -