Browse Source

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2081 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61

shortcuts
Dickon Field 19 years ago
parent
commit
3c1cb596a8
  1. 12
      src/AddIns/Misc/SharpServerTools/SharpDbTools/SharpDbTools.csproj
  2. 5
      src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/DatabaseExplorerTreeNode.cs
  3. 15
      src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/DbModelInfoTreeNode.cs
  4. 136
      src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.Designer.cs
  5. 68
      src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.cs
  6. 120
      src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.resx
  7. 49
      src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLToolViewContent.cs
  8. 9
      src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/TableTreeNode.cs

12
src/AddIns/Misc/SharpServerTools/SharpDbTools/SharpDbTools.csproj

@ -33,6 +33,11 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Src\Configuration\AssemblyInfo.cs" /> <Compile Include="Src\Configuration\AssemblyInfo.cs" />
<Compile Include="Src\Forms\SQLTool.cs" />
<Compile Include="Src\Forms\SQLTool.Designer.cs">
<DependentUpon>SQLTool.cs</DependentUpon>
</Compile>
<Compile Include="Src\Forms\SQLToolViewContent.cs" />
<Compile Include="Src\Forms\TableDescribeViewContent.cs" /> <Compile Include="Src\Forms\TableDescribeViewContent.cs" />
<Compile Include="Src\Forms\ConnectionStringDefinitionDialog.cs" /> <Compile Include="Src\Forms\ConnectionStringDefinitionDialog.cs" />
<Compile Include="Src\Forms\ConnectionStringDefinitionDialog.Designer.cs" /> <Compile Include="Src\Forms\ConnectionStringDefinitionDialog.Designer.cs" />
@ -43,6 +48,9 @@
<EmbeddedResource Include="Src\Forms\ConnectionStringDefinitionDialog.resx"> <EmbeddedResource Include="Src\Forms\ConnectionStringDefinitionDialog.resx">
<DependentUpon>ConnectionStringDefinitionDialog.cs</DependentUpon> <DependentUpon>ConnectionStringDefinitionDialog.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Src\Forms\SQLTool.resx">
<DependentUpon>SQLTool.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="Src\Data\TableNames.cs" /> <Compile Include="Src\Data\TableNames.cs" />
<Compile Include="Src\Data\ColumnNames.cs" /> <Compile Include="Src\Data\ColumnNames.cs" />
<Compile Include="Src\Data\DbModelInfo.cs" /> <Compile Include="Src\Data\DbModelInfo.cs" />
@ -55,6 +63,10 @@
<Folder Include="Src\Configuration" /> <Folder Include="Src\Configuration" />
<Folder Include="Src\Data" /> <Folder Include="Src\Data" />
<Folder Include="Src\Forms" /> <Folder Include="Src\Forms" />
<ProjectReference Include="..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj">
<Project>{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}</Project>
<Name>ICSharpCode.TextEditor</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj"> <ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> <Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name> <Name>ICSharpCode.Core</Name>

5
src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/DatabaseExplorerTreeNode.cs

@ -10,7 +10,10 @@ using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
using ICSharpCode.Core; using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using SharpDbTools.Data; using SharpDbTools.Data;
using SharpServerTools.Forms; using SharpServerTools.Forms;
namespace SharpDbTools.Forms namespace SharpDbTools.Forms
@ -37,6 +40,8 @@ namespace SharpDbTools.Forms
saveMetadataMenuItem.Click += new EventHandler(SaveDbModelInfoClickHandler); saveMetadataMenuItem.Click += new EventHandler(SaveDbModelInfoClickHandler);
cMenu.Items.AddRange(new ToolStripMenuItem[] cMenu.Items.AddRange(new ToolStripMenuItem[]
{ {
addConnectionMenuItem, addConnectionMenuItem,

15
src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/DbModelInfoTreeNode.cs

@ -11,6 +11,8 @@ using System.Data.Common;
using System.Windows.Forms; using System.Windows.Forms;
using ICSharpCode.Core; using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using SharpDbTools.Data; using SharpDbTools.Data;
using SharpServerTools.Forms; using SharpServerTools.Forms;
@ -56,12 +58,15 @@ namespace SharpDbTools.Forms
new ToolStripMenuItem("Load Metadata from File"); new ToolStripMenuItem("Load Metadata from File");
loadMetadataFromFileMenuItem.Click += new EventHandler(LoadMetadataFromFileClickHandler); loadMetadataFromFileMenuItem.Click += new EventHandler(LoadMetadataFromFileClickHandler);
ToolStripMenuItem openSQLToolMenuItem = new ToolStripMenuItem("Open SQL Tool");
openSQLToolMenuItem.Click += new EventHandler(OpenSQLToolClickHandler);
cMenu.Items.AddRange(new ToolStripMenuItem[] cMenu.Items.AddRange(new ToolStripMenuItem[]
{ {
setConnectionStringMenuItem, setConnectionStringMenuItem,
loadMetadataFromConnectionMenuItem, loadMetadataFromConnectionMenuItem,
loadMetadataFromFileMenuItem loadMetadataFromFileMenuItem,
openSQLToolMenuItem
}); });
this.ContextMenuStrip = cMenu; this.ContextMenuStrip = cMenu;
@ -168,7 +173,7 @@ namespace SharpDbTools.Forms
private void SetConnectionStringOnDbModelInfoClickHandler(object sender, EventArgs e) private void SetConnectionStringOnDbModelInfoClickHandler(object sender, EventArgs e)
{ {
string connectionLogicalName = this.Text; string connectionLogicalName = (string)this.Tag;
LoggingService.Debug("add connection string clicked for item with name: " + connectionLogicalName); LoggingService.Debug("add connection string clicked for item with name: " + connectionLogicalName);
// use the ConnectionStringDefinitionDialog to get a connection string and invariant name // use the ConnectionStringDefinitionDialog to get a connection string and invariant name
@ -213,6 +218,12 @@ namespace SharpDbTools.Forms
this.backgroundWorker.RunWorkerAsync(logicalConnectionName); 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) private void TimerClick(object sender, EventArgs eventArgs)
{ {
string ellipsis = progress.Text; string ellipsis = progress.Text;

136
src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.Designer.cs generated

@ -0,0 +1,136 @@
/*
* User: dickon
* Date: 21/11/2006
* Time: 19:12
*
*/
namespace SharpDbTools.Forms
{
partial class SQLTool : System.Windows.Forms.UserControl
{
/// <summary>
/// Designer variable used to keep track of non-visual components.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Disposes resources used by the control.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing) {
if (components != null) {
components.Dispose();
}
}
base.Dispose(disposing);
}
/// <summary>
/// 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.
/// </summary>
private void InitializeComponent()
{
this.sqlToolTabControl = new System.Windows.Forms.TabControl();
this.editorTab = new System.Windows.Forms.TabPage();
this.resultTab = new System.Windows.Forms.TabPage();
this.messageTab = new System.Windows.Forms.TabPage();
this.resultDataGridView = new System.Windows.Forms.DataGridView();
this.messageTextBox = new System.Windows.Forms.TextBox();
this.sqlToolTabControl.SuspendLayout();
this.resultTab.SuspendLayout();
this.messageTab.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.resultDataGridView)).BeginInit();
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(885, 522);
this.sqlToolTabControl.TabIndex = 0;
this.sqlToolTabControl.UseWaitCursor = true;
//
// editorTab
//
this.editorTab.Location = new System.Drawing.Point(4, 24);
this.editorTab.Name = "editorTab";
this.editorTab.Padding = new System.Windows.Forms.Padding(3);
this.editorTab.Size = new System.Drawing.Size(877, 494);
this.editorTab.TabIndex = 0;
this.editorTab.Text = "Editor";
this.editorTab.UseVisualStyleBackColor = true;
this.editorTab.UseWaitCursor = true;
//
// resultTab
//
this.resultTab.Controls.Add(this.resultDataGridView);
this.resultTab.Location = new System.Drawing.Point(4, 24);
this.resultTab.Name = "resultTab";
this.resultTab.Padding = new System.Windows.Forms.Padding(3);
this.resultTab.Size = new System.Drawing.Size(877, 494);
this.resultTab.TabIndex = 1;
this.resultTab.Text = "Results";
this.resultTab.UseVisualStyleBackColor = true;
this.resultTab.UseWaitCursor = true;
//
// messageTab
//
this.messageTab.Controls.Add(this.messageTextBox);
this.messageTab.Location = new System.Drawing.Point(4, 24);
this.messageTab.Name = "messageTab";
this.messageTab.Padding = new System.Windows.Forms.Padding(3);
this.messageTab.Size = new System.Drawing.Size(877, 494);
this.messageTab.TabIndex = 2;
this.messageTab.Text = "Messages";
this.messageTab.UseVisualStyleBackColor = true;
this.messageTab.UseWaitCursor = true;
//
// dataGridView1
//
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(871, 488);
this.resultDataGridView.TabIndex = 0;
//
// textBox1
//
this.messageTextBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.messageTextBox.Location = new System.Drawing.Point(3, 3);
this.messageTextBox.Multiline = true;
this.messageTextBox.Name = "messages";
this.messageTextBox.Size = new System.Drawing.Size(871, 488);
this.messageTextBox.TabIndex = 0;
//
// SQLTool
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.sqlToolTabControl);
this.Name = "SQLTool";
this.Size = new System.Drawing.Size(885, 522);
this.sqlToolTabControl.ResumeLayout(false);
this.resultTab.ResumeLayout(false);
this.messageTab.ResumeLayout(false);
this.messageTab.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.resultDataGridView)).EndInit();
this.ResumeLayout(false);
}
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;
}
}

68
src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.cs

@ -0,0 +1,68 @@
/*
* User: dickon
* Date: 21/11/2006
* Time: 19:12
*
*/
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using ICSharpCode.TextEditor;
using ICSharpCode.Core;
namespace SharpDbTools.Forms
{
/// <summary>
/// Description of SQLEditorQueryTool.
/// </summary>
public partial class SQLTool
{
private string logicalConnectionName = null;
private TextEditorControl sqlEditorControl = null;
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 TextEditorControl();
sqlEditorControl.Dock = DockStyle.Fill;
sqlEditorControl.SetHighlighting("SQL");
this.editorTab.Controls.Add(sqlEditorControl);
// add context behaviour to the editor control
ContextMenuStrip contextMenu = new ContextMenuStrip();
ToolStripMenuItem executeSQLMenuItem = new ToolStripMenuItem("Execute SQL");
executeSQLMenuItem.Click += new EventHandler(ExecuteSQLClickHandler);
contextMenu.Items.AddRange(new ToolStripMenuItem[]
{
executeSQLMenuItem
});
sqlEditorControl.ContextMenuStrip = contextMenu;
}
private void ExecuteSQLClickHandler(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 + "-> ExecuteSQLClickHandler");
// TODO: hand off the execution of the query to a background thread...
}
}
}

120
src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.resx

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

49
src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLToolViewContent.cs

@ -0,0 +1,49 @@
/*
* 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
{
/// <summary>
/// Description of SQLEditorQueryToolViewContent.
/// </summary>
public class SQLToolViewContent : AbstractViewContent
{
string logicalConnectionName;
SQLTool sqlTool;
public SQLToolViewContent(string logicalConnectionName):
base("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;
}
}
}
}

9
src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/TableTreeNode.cs

@ -29,9 +29,16 @@ namespace SharpDbTools.Forms
{ {
this.logicalConnectionName = logicalConnectionName; this.logicalConnectionName = logicalConnectionName;
NodeAwareContextMenuStrip cMenu = new NodeAwareContextMenuStrip(this); NodeAwareContextMenuStrip cMenu = new NodeAwareContextMenuStrip(this);
ToolStripMenuItem invokeDescriberMenuItem = new ToolStripMenuItem("Describe"); ToolStripMenuItem invokeDescriberMenuItem = new ToolStripMenuItem("Describe");
invokeDescriberMenuItem.Click += new EventHandler(DescribeTableClickHandler); invokeDescriberMenuItem.Click += new EventHandler(DescribeTableClickHandler);
cMenu.Items.Add(invokeDescriberMenuItem);
cMenu.Items.AddRange(new ToolStripMenuItem[]
{
invokeDescriberMenuItem
});
this.ContextMenuStrip = cMenu; this.ContextMenuStrip = cMenu;
} }

Loading…
Cancel
Save