Browse Source

Remove unfinished Addins: SettingsEditor and WorkflowDesigner. These won't ship with 3.0.

Removed SharpServerTools.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3395 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
5b0ab0d77c
  1. 3
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/ClassDiagramAddin.addin
  2. 3
      src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/ClassWizard.addin
  3. 45
      src/AddIns/DisplayBindings/ServerTools/DbControlController.cs
  4. 48
      src/AddIns/DisplayBindings/ServerTools/DbControlNode.cs
  5. 24
      src/AddIns/DisplayBindings/ServerTools/ICSharpCode.ServerTools.addin
  6. 157
      src/AddIns/DisplayBindings/ServerTools/ICSharpCode.ServerTools.csproj
  7. 57
      src/AddIns/DisplayBindings/ServerTools/Properties/AssemblyInfo.cs
  8. 71
      src/AddIns/DisplayBindings/ServerTools/Properties/Resources.Designer.cs
  9. 117
      src/AddIns/DisplayBindings/ServerTools/Properties/Resources.resx
  10. 30
      src/AddIns/DisplayBindings/ServerTools/Properties/Settings.Designer.cs
  11. 7
      src/AddIns/DisplayBindings/ServerTools/Properties/Settings.settings
  12. 63
      src/AddIns/DisplayBindings/ServerTools/ServerBrowserHost.cs
  13. 27
      src/AddIns/DisplayBindings/ServerTools/ServerControl.xaml
  14. 98
      src/AddIns/DisplayBindings/ServerTools/ServerControl.xaml.cs
  15. 20
      src/AddIns/DisplayBindings/SettingsEditor/Project/Configuration/AssemblyInfo.cs
  16. 32
      src/AddIns/DisplayBindings/SettingsEditor/Project/ISettingsEntryHost.cs
  17. 72
      src/AddIns/DisplayBindings/SettingsEditor/Project/ProxyPropertyDescriptor.cs
  18. 107
      src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsCodeGeneratorTool.cs
  19. 29
      src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsDisplayBinding.cs
  20. 76
      src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsDocument.cs
  21. 23
      src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsEditor.addin
  22. 87
      src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsEditor.csproj
  23. 293
      src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsEntry.cs
  24. 148
      src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsEntryPropertyGridWrapper.cs
  25. 140
      src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.Designer.cs
  26. 173
      src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.cs
  27. 126
      src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.resx
  28. 97
      src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsViewContent.cs
  29. 72
      src/AddIns/DisplayBindings/SettingsEditor/Project/SpecialTypes.cs
  30. 22
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Configuration/AssemblyInfo.cs
  31. 45
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Gui/ViewContentControl.Designer.cs
  32. 222
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Gui/ViewContentControl.cs
  33. 152
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Loaders/BasicWorkflowDesignerLoader.cs
  34. 290
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Loaders/CodeDesignerLoader.cs
  35. 35
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Loaders/WorkflowDesignerLoadException.cs
  36. 137
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Loaders/XomlDesignerLoader.cs
  37. 36
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/PrimaryView/PrimaryDisplayBinding.cs
  38. 84
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/PrimaryView/PrimaryViewContent.cs
  39. 115
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/SecondaryView/SecondaryDisplayBinding.cs
  40. 67
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/SecondaryView/SecondaryViewContent.cs
  41. 74
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/EventBindingService/CSharpWorkflowDesignerEventBindingService.cs
  42. 201
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/EventBindingService/EventPropertyDescriptor.cs
  43. 25
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/EventBindingService/IWorkflowDesignerEventBindingService.cs
  44. 425
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/EventBindingService/WorkflowDesignerEventBindingService.cs
  45. 73
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/ExtendedUIService.cs
  46. 96
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/MemberCreationService.cs
  47. 75
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/PropertyValueUIService.cs
  48. 349
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/TypeProviderService.cs
  49. 137
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/TypeResolutionService.cs
  50. 139
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/WorkflowMenuCommandService.cs
  51. 388
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/WorkflowSideTabService.cs
  52. 204
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/WorkflowToolboxService.cs
  53. 38
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Templates/Files/CSharp/Activity.xft
  54. 38
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Templates/Files/CSharp/CodeSeparationSequentialWorkflow.xft
  55. 61
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Templates/Files/CSharp/CodeSequentialWorkflow.xft
  56. 26
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Templates/Files/NoCodeSequentialWorkflow.xft
  57. 103
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Templates/Projects/CSharp/ActivityLibrary.xpt
  58. 136
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Templates/Projects/CSharp/ConsoleProject.xpt
  59. 69
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/Templates/Projects/CSharp/EmptyProject.xpt
  60. 46
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/WorkflowDesigner.addin
  61. 170
      src/AddIns/DisplayBindings/WorkflowDesigner/Project/WorkflowDesigner.csproj
  62. 2
      src/AddIns/Misc/ReflectorAddIn/ReflectorAddIn/Project/ReflectorAddIn.addin
  63. 15
      src/AddIns/Misc/SharpServerTools/DataTools.Model/Configuration/AssemblyInfo.cs
  64. 63
      src/AddIns/Misc/SharpServerTools/DataTools.Model/DataTools.Model.csproj
  65. 22
      src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/ColumnNames.cs
  66. 170
      src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbModelInfo.cs
  67. 301
      src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbModelInfoService.cs
  68. 40
      src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbProvidersException.cs
  69. 132
      src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbProvidersService.cs
  70. 22
      src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/MetadataNames.cs
  71. 15
      src/AddIns/Misc/SharpServerTools/DataTools.UI/Configuration/AssemblyInfo.cs
  72. 65
      src/AddIns/Misc/SharpServerTools/DataTools.UI/DataTools.UI.csproj
  73. 205
      src/AddIns/Misc/SharpServerTools/DataTools.UI/Resources/Strings.resx
  74. 236
      src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.Designer.cs
  75. 286
      src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.cs
  76. 126
      src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.resx
  77. 120
      src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Resources/Strings.resx
  78. 75
      src/AddIns/Misc/SharpServerTools/ServerBrowserTool/ServerBrowserTool.csproj
  79. 6
      src/AddIns/Misc/SharpServerTools/ServerBrowserTool/ServerBrowserTool.sln
  80. 48
      src/AddIns/Misc/SharpServerTools/ServerBrowserTool/SharpServerTools.addin
  81. 21
      src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Configuration/AssemblyInfo.cs
  82. 19
      src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/IInitializable.cs
  83. 23
      src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ISupportsDragDrop.cs
  84. 28
      src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/NodeAwareContextMenuStrip.cs
  85. 56
      src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ProgressEllipsis.cs
  86. 54
      src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/RebuildRequiredEvents.cs
  87. 64
      src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ServerBrowserTool.cs
  88. 108
      src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ServerToolTreeView.cs
  89. 109
      src/AddIns/Misc/SharpServerTools/SharpDbTools/DataTools.AddIn.csproj
  90. 159
      src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/SQL.xshd
  91. 205
      src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/Strings.resx
  92. 5
      src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/SyntaxModes.xml
  93. 6
      src/AddIns/Misc/SharpServerTools/SharpDbTools/SharpDbTools.sln
  94. 20
      src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Configuration/AssemblyInfo.cs
  95. 109
      src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms.TextEditor/SQLTextEditorControl.cs
  96. 186
      src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/DatabaseExplorerTreeNode.cs
  97. 305
      src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/DbModelInfoTreeNode.cs
  98. 52
      src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/FormsArtefactFactories.cs
  99. 32
      src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/FormsArtefactFactory.cs
  100. 167
      src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/SQLTool.Designer.cs
  101. Some files were not shown because too many files have changed in this diff Show More

3
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/ClassDiagramAddin.addin

@ -5,8 +5,7 @@ @@ -5,8 +5,7 @@
description = "Shows a visual class diagram of the project.">
<Manifest>
<Identity name="ClassDiagram" version="@ClassDiagramAddin.dll"/>
<Dependency addin="SharpDevelop" version="3.0"/>
<Identity name="ClassDiagram" />
</Manifest>
<Runtime>

3
src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/ClassWizard.addin

@ -5,8 +5,7 @@ @@ -5,8 +5,7 @@
description = "Visually add new classes to the project.">
<Manifest>
<Identity name="ClassWizard" version="@ClassWizard.dll"/>
<Dependency addin="SharpDevelop" version="3.0"/>
<Identity name="ClassWizard" />
</Manifest>
<Runtime>

45
src/AddIns/DisplayBindings/ServerTools/DbControlController.cs

@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
/*
* Created by SharpDevelop.
* User: dickon
* Date: 15/01/2008
* Time: 16:47
*
*/
using System;
using System.Windows.Controls;
using System.Collections.Generic;
using System.Data.OleDb;
using dbtool = ICSharpCode.DataTools.OleDbConnectionUtil;
namespace ICSharpCode.ServerTools
{
/// <summary>
/// Description of DbToolController.
/// </summary>
public static class DbControlController
{
private static Dictionary<string, OleDbConnection> connections =
new Dictionary<string, OleDbConnection>();
/// <summary>
/// Lookup the connection for the named db node,
/// </summary>
/// <param name="dbNode"></param>
public static void BuildDbNode(TreeViewItem dbNode, string connectionName)
{
}
public static bool TryGetConnection(string connectionName, out OleDbConnection connection)
{
if (connections.TryGetValue(connectionName, out connection)) {
return true;
} else {
// TODO: use OleDbUtils to get a connection if possible.
return false;
}
}
}
}

48
src/AddIns/DisplayBindings/ServerTools/DbControlNode.cs

@ -1,48 +0,0 @@ @@ -1,48 +0,0 @@
/*
* Created by SharpDevelop.
* User: dickon
* Date: 15/01/2008
* Time: 18:15
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Windows.Controls;
namespace ICSharpCode.ServerTools
{
/// <summary>
/// Description of DbNode.
/// </summary>
public class DbControlNode : TreeViewItem
{
private DbControlNodeState state;
public DbControlNode(string name)
{
this.Name = name;
}
public DbControlNode(string name, DbControlNodeState state)
{
this.Name = name;
this.state = state;
}
public DbControlNodeState State {
get {
return this.state;
}
set {
this.state = value;
}
}
}
public enum DbControlNodeState
{
Open,
Closed
}
}

24
src/AddIns/DisplayBindings/ServerTools/ICSharpCode.ServerTools.addin

@ -1,24 +0,0 @@ @@ -1,24 +0,0 @@
<AddIn name = "ICSharpCode.ServerTools"
author = "Dickon Field"
url = "www.softwarefabric.com"
description = "A collection of components and tools to help develop db-aware apps... and more">
<Manifest>
<Identity name = "ICSharpCode.ServerTools"/>
</Manifest>
<Runtime>
<Import assembly ="ICSharpCode.ServerTools.dll"/>
<Import assembly="MyMeta.dll"/>
<Import assembly="ICSharpCode.DataTools.dll"/>
</Runtime>
<Path name = "/SharpDevelop/Workbench/Pads">
<Pad id = "SharpServerToolsPad"
category = "Main"
title = "Server Explorer"
icon = "ServerTool.Server"
shortcut = "Control|Alt|D"
class = "ICSharpCode.ServerTools.ServerBrowserHost"/>
</Path>
</AddIn>

157
src/AddIns/DisplayBindings/ServerTools/ICSharpCode.ServerTools.csproj

@ -1,157 +0,0 @@ @@ -1,157 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8CF1EB90-324F-4AA9-BAA2-DEF87392CE86}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ICSharpCode.ServerTools</RootNamespace>
<AssemblyName>ICSharpCode.ServerTools</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\..\AddIns\AddIns\DisplayBindings\ServerTools\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data.DataSetExtensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UIAutomationProvider">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="PresentationCore">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="PresentationFramework">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsFormsIntegration">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Page Include="ServerControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Compile Include="DbControlNode.cs" />
<Compile Include="DbControlController.cs" />
<Compile Include="ServerControl.xaml.cs">
<DependentUpon>ServerControl.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<ProjectReference Include="..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
</ProjectReference>
<COMReference Include="ADODB">
<Guid>{EF53050B-882E-4776-B643-EDA472E8E3F2}</Guid>
<VersionMajor>2</VersionMajor>
<VersionMinor>7</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<COMReference Include="MSDASC">
<Guid>{2206CEB0-19C1-11D1-89E0-00C04FD7A829}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
<None Include="ICSharpCode.ServerTools.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="ServerBrowserHost.cs" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Libraries\ICSharpCode.DataTools\ICSharpCode.DataTools.csproj">
<Project>{6CC3DF82-E815-483F-B4B5-85191064D981}</Project>
<Name>ICSharpCode.DataTools</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

57
src/AddIns/DisplayBindings/ServerTools/Properties/AssemblyInfo.cs

@ -1,57 +0,0 @@ @@ -1,57 +0,0 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SharpServerTools.Servers")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SharpServerTools.Servers")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("TestServerControl")]

71
src/AddIns/DisplayBindings/ServerTools/Properties/Resources.Designer.cs generated

@ -1,71 +0,0 @@ @@ -1,71 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1378
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ICSharpCode.ServerTools.Servers.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharpServerTools.Servers.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

117
src/AddIns/DisplayBindings/ServerTools/Properties/Resources.resx

@ -1,117 +0,0 @@ @@ -1,117 +0,0 @@
<?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.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: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" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</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" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</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>

30
src/AddIns/DisplayBindings/ServerTools/Properties/Settings.Designer.cs generated

@ -1,30 +0,0 @@ @@ -1,30 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1378
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ICSharpCode.ServerTools.Servers.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

7
src/AddIns/DisplayBindings/ServerTools/Properties/Settings.settings

@ -1,7 +0,0 @@ @@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

63
src/AddIns/DisplayBindings/ServerTools/ServerBrowserHost.cs

@ -1,63 +0,0 @@ @@ -1,63 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Windows.Forms;
using System.Windows.Forms.Integration;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.ServerTools;
namespace ICSharpCode.ServerTools
{
/// <summary>
/// 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.
/// </summary>
public class ServerBrowserHost : AbstractPadContent
{
ElementHost ctl;
/// <summary>
/// ServerBrowserTool hosts one or more TreeViews providing views of types
/// of server. Currently it shows only relational database servers.
/// </summary>
public ServerBrowserHost()
{
LoggingService.Debug("Loading ServerBrowserHost");
ctl = new ElementHost();
ServerControl serverControl = new ServerControl();
ctl.Child = serverControl;
}
/// <summary>
/// The <see cref="System.Windows.Forms.Control"/> representing the pad
/// </summary>
public override Control Control {
get {
return ctl;
}
}
/// <summary>
/// Rebuildes the pad
/// </summary>
public override void RedrawContent()
{
}
/// <summary>
/// Cleans up all used resources
/// </summary>
public override void Dispose()
{
ctl.Dispose();
}
}
}

27
src/AddIns/DisplayBindings/ServerTools/ServerControl.xaml

@ -1,27 +0,0 @@ @@ -1,27 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<UserControl
x:Class="ICSharpCode.ServerTools.ServerControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="300"
Width="300">
<DockPanel>
<ToolBar
DockPanel.Dock="Top"
Name="serverToolBar"
Grid.Column="0"
Grid.Row="0">
<Button
Name="refreshButton">R</Button>
<Button
Name="stopRefreshButton">S</Button>
<Button
Name="addConnectionButton"
Click="addConnectionButton_Click">A</Button>
</ToolBar>
<TreeView
Name="serverTree">
<TreeViewItem
Name="dbTree"
Header="Data Connections"></TreeViewItem>
</TreeView>
</DockPanel>
</UserControl>

98
src/AddIns/DisplayBindings/ServerTools/ServerControl.xaml.cs

@ -1,98 +0,0 @@ @@ -1,98 +0,0 @@
using System;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Data;
using System.Data.OleDb;
using System.Data.Common;
using System.Configuration;
using System.Collections.Generic;
using ICSharpCode.DataTools;
using log = ICSharpCode.Core.LoggingService;
namespace ICSharpCode.ServerTools
{
/// <summary>
/// Interaction logic for UserControl1.xaml
/// </summary>
public partial class ServerControl : UserControl
{
public ServerControl()
{
InitializeComponent();
Refresh();
}
public void Refresh()
{
log.Debug("refreshing ServerControl");
log.Debug("loading oledb connection strings");
ConnectionStringSettingsCollection c
= OleDbConnectionUtil.GetConnectionSettingsCollection();
this.dbTree.Items.Clear();
foreach (ConnectionStringSettings s in c)
{
TreeViewItem n = new TreeViewItem();
n.Header = s.Name;
this.dbTree.Items.Add(n);
}
}
/// <summary>
/// Uses the DataLink dialog to define a new Oledb connection string,
/// tests it, and adds it to the exe config.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void addConnectionButton_Click(object sender, RoutedEventArgs e)
{
MSDASC.DataLinks mydlg = new MSDASC.DataLinks();
OleDbConnection oleCon = new OleDbConnection();
ADODB._Connection aDOcon;
//Cast the generic object that PromptNew returns to an ADODB._Connection.
aDOcon = (ADODB._Connection)mydlg.PromptNew();
if (aDOcon == null)
{
return;
}
oleCon.ConnectionString = aDOcon.ConnectionString;
oleCon.Open();
if (oleCon.State.ToString() == "Open")
{
// If we get to here, we have a valid oledb
// connection string, at least on the basis of the current
// state of the platform that it refers to.
// Now construct a name for the connection string settings based on
// the attributes of the connection string and save it.
// VS08 assumes the following naming scheme:
// connection name ::= <provider name>.<host name>\<server name>.<catalog name>
string provider = oleCon.Provider;
string source = oleCon.DataSource;
string catalogue = oleCon.Database;
string dbServerName = @provider + ":" + @source + "." + @catalogue;
OleDbConnectionUtil.Put(dbServerName, oleCon.ConnectionString);
OleDbConnectionUtil.Save();
this.Refresh();
oleCon.Close();
}
else
{
MessageBox.Show("Connection Failed");
}
}
}
}

20
src/AddIns/DisplayBindings/SettingsEditor/Project/Configuration/AssemblyInfo.cs

@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision: 1965 $</version>
// </file>
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("SettingsEditor")]
[assembly: AssemblyDescription("SharpDevelop Settings Editor AddIn")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

32
src/AddIns/DisplayBindings/SettingsEditor/Project/ISettingsEntryHost.cs

@ -1,32 +0,0 @@ @@ -1,32 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
namespace ICSharpCode.SettingsEditor
{
public interface ISettingsEntryHost
{
string GetDisplayNameForType(Type type);
Type GetTypeByDisplayName(string displayName);
}
sealed class DummySettingsEntryHost : ISettingsEntryHost
{
public readonly static DummySettingsEntryHost Instance = new DummySettingsEntryHost();
public string GetDisplayNameForType(Type type)
{
return type.AssemblyQualifiedName;
}
public Type GetTypeByDisplayName(string displayName)
{
return Type.GetType(displayName);
}
}
}

72
src/AddIns/DisplayBindings/SettingsEditor/Project/ProxyPropertyDescriptor.cs

@ -1,72 +0,0 @@ @@ -1,72 +0,0 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 10/29/2006
* Time: 8:30 AM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.ComponentModel;
using System.Reflection;
namespace ICSharpCode.SettingsEditor
{
/// <summary>
/// Forwards calls to the ProxyPropertyDescriptor to the base descriptor.
/// </summary>
public abstract class ProxyPropertyDescriptor : PropertyDescriptor
{
PropertyDescriptor baseDescriptor;
protected ProxyPropertyDescriptor(PropertyDescriptor baseDescriptor)
: base(baseDescriptor)
{
this.baseDescriptor = baseDescriptor;
}
public override Type ComponentType {
get {
return baseDescriptor.ComponentType;
}
}
public override bool IsReadOnly {
get {
return baseDescriptor.IsReadOnly;
}
}
public override bool CanResetValue(object component)
{
return baseDescriptor.CanResetValue(component);
}
public override object GetValue(object component)
{
return baseDescriptor.GetValue(component);
}
public override void ResetValue(object component)
{
baseDescriptor.ResetValue(component);
}
public override void SetValue(object component, object value)
{
baseDescriptor.SetValue(component, value);
}
public override bool ShouldSerializeValue(object component)
{
return baseDescriptor.ShouldSerializeValue(component);
}
public override Type PropertyType {
get {
return baseDescriptor.PropertyType;
}
}
}
}

107
src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsCodeGeneratorTool.cs

@ -1,107 +0,0 @@ @@ -1,107 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.CodeDom;
using System.Configuration;
using System.Diagnostics;
using System.Reflection;
using System.Xml;
using ICSharpCode.EasyCodeDom;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.SettingsEditor
{
public class SettingsCodeGeneratorTool : ICustomTool
{
public void GenerateCode(FileProjectItem item, CustomToolContext context)
{
XmlDocument doc = new XmlDocument();
doc.Load(item.FileName);
SettingsDocument setDoc = new SettingsDocument(doc.DocumentElement, DummySettingsEntryHost.Instance);
string customToolNamespace = item.GetEvaluatedMetadata("CustomToolNamespace");
if (!string.IsNullOrEmpty(customToolNamespace)) {
setDoc.GeneratedClassNamespace = customToolNamespace;
}
EasyCompileUnit ccu = new EasyCompileUnit();
ccu.AddNamespace(setDoc.GeneratedClassNamespace).Types.Add(CreateClass(setDoc));
context.WriteCodeDomToFile(item, context.GetOutputFileName(item, ".Designer"), ccu);
}
public static CodeTypeDeclaration CreateClass(SettingsDocument setDoc)
{
EasyTypeDeclaration c = new EasyTypeDeclaration(setDoc.GeneratedClassName);
c.AddAttribute(typeof(System.Runtime.CompilerServices.CompilerGeneratedAttribute));
c.AddAttribute(typeof(System.CodeDom.Compiler.GeneratedCodeAttribute),
Easy.Prim(typeof(SettingsCodeGeneratorTool).FullName),
Easy.Prim(typeof(SettingsCodeGeneratorTool).Assembly.GetName().Version.ToString()));
c.TypeAttributes = TypeAttributes.NotPublic | TypeAttributes.Sealed;
c.IsPartial = true;
c.BaseTypes.Add(Easy.TypeRef(typeof(ApplicationSettingsBase)));
EasyField f = c.AddField(Easy.TypeRef(c), "defaultInstance");
f.Attributes = MemberAttributes.Private | MemberAttributes.Static;
f.InitExpression = Easy.Type(typeof(ApplicationSettingsBase))
.InvokeMethod("Synchronized", Easy.New(Easy.TypeRef(c)))
.CastTo(Easy.TypeRef(c));
c.AddProperty(f, "Default");
foreach (SettingsEntry entry in setDoc.Entries) {
Type entryType = entry.Type ?? typeof(string);
SpecialSetting? specialSetting = null;
foreach (SpecialTypeDescriptor desc in SpecialTypeDescriptor.Descriptors) {
if (desc.type == entryType) {
entryType = typeof(string);
specialSetting = desc.specialSetting;
break;
}
}
EasyProperty p = c.AddProperty(entryType, entry.Name);
if (entry.Scope == SettingScope.User) {
p.AddAttribute(typeof(UserScopedSettingAttribute));
} else {
p.AddAttribute(typeof(ApplicationScopedSettingAttribute));
}
if (!string.IsNullOrEmpty(entry.Provider)) {
p.AddAttribute(typeof(SettingsProviderAttribute),
Easy.TypeOf(new CodeTypeReference(entry.Provider)));
}
if (!string.IsNullOrEmpty(entry.Description)) {
p.AddAttribute(typeof(SettingsDescriptionAttribute), Easy.Prim(entry.Description));
Easy.AddSummary(p, entry.Description);
}
p.AddAttribute(typeof(DebuggerNonUserCodeAttribute));
if (specialSetting != null) {
p.AddAttribute(typeof(SpecialSettingAttribute),
Easy.Prim(specialSetting.Value));
}
if (entry.GenerateDefaultValueInCode) {
p.AddAttribute(typeof(DefaultSettingValueAttribute), Easy.Prim(entry.SerializedValue));
}
if (entry.Scope == SettingScope.User && entry.Roaming) {
p.AddAttribute(typeof(SettingsManageabilityAttribute),
Easy.Prim(SettingsManageability.Roaming));
}
p.Getter.Return(Easy.This.Index(Easy.Prim(entry.Name)).CastTo(entryType));
// p.GetStatements.Add(new CodeMethodReturnStatement(
// new CodeCastExpression(new CodeTypeReference(entryType),
// new CodeIndexerExpression(new CodeThisReferenceExpression(),
// new CodePrimitiveExpression(entry.Name))
// )
// ));
if (entry.Scope == SettingScope.User) {
p.Setter.Assign(Easy.This.Index(Easy.Prim(entry.Name)), Easy.Value);
}
}
return c;
}
}
}

29
src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsDisplayBinding.cs

@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 10/28/2006
* Time: 5:51 PM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SettingsEditor
{
public sealed class SettingsDisplayBinding : IDisplayBinding
{
public bool CanCreateContentForFile(string fileName)
{
return true;
}
public IViewContent CreateContentForFile(OpenedFile file)
{
return new SettingsViewContent(file);
}
}
}

76
src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsDocument.cs

@ -1,76 +0,0 @@ @@ -1,76 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Xml;
using System.Collections.Generic;
namespace ICSharpCode.SettingsEditor
{
public class SettingsDocument
{
string generatedClassNamespace = "";
string generatedClassName = "";
List<SettingsEntry> entries = new List<SettingsEntry>();
public string GeneratedClassNamespace {
get { return generatedClassNamespace; }
set { generatedClassNamespace = value ?? ""; }
}
public string GeneratedClassName {
get { return generatedClassName; }
set { generatedClassName = value ?? ""; }
}
public List<SettingsEntry> Entries {
get { return entries; }
}
public SettingsDocument()
{
}
const string XmlNamespace = "http://schemas.microsoft.com/VisualStudio/2004/01/settings";
public SettingsDocument(XmlElement settingsFile, ISettingsEntryHost host)
{
generatedClassNamespace = settingsFile.GetAttribute("GeneratedClassNamespace");
generatedClassName = settingsFile.GetAttribute("GeneratedClassName");
XmlElement settings = settingsFile["Settings"];
foreach (XmlNode node in settings.ChildNodes) {
if (node is XmlElement) {
entries.Add(new SettingsEntry(host, node as XmlElement));
}
}
}
public void Save(XmlWriter writer)
{
writer.WriteStartElement("SettingsFile", XmlNamespace);
writer.WriteAttributeString("CurrentProfile", "(Default)");
writer.WriteAttributeString("GeneratedClassNamespace", generatedClassNamespace);
writer.WriteAttributeString("GeneratedClassName", generatedClassName);
writer.WriteStartElement("Profiles");
writer.WriteStartElement("Profile");
writer.WriteAttributeString("Name", "(Default)");
writer.WriteEndElement(); // Profile
writer.WriteEndElement(); // Profiles
writer.WriteStartElement("Settings");
foreach (SettingsEntry e in entries) {
e.WriteTo(writer);
}
writer.WriteEndElement(); // Settings
writer.WriteEndElement(); // SettingsFile
}
}
}

23
src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsEditor.addin

@ -1,23 +0,0 @@ @@ -1,23 +0,0 @@
<AddIn name = "Settings Editor"
author = "Daniel Grunwald"
copyright = "prj:///doc/copyright.txt"
description = "Edits project settings">
<Runtime>
<Import assembly = "SettingsEditor.dll"/>
</Runtime>
<Path name = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "SettingsEditor"
insertbefore = "Text"
class = "ICSharpCode.SettingsEditor.SettingsDisplayBinding"
fileNamePattern = "\.settings$"
title = "Settings editor"/>
</Path>
<Path name = "/SharpDevelop/CustomTools">
<CustomTool id = "SettingsSingleFileGenerator"
class = "ICSharpCode.SettingsEditor.SettingsCodeGeneratorTool"
fileNamePattern = "\.settings$"/>
</Path>
</AddIn>

87
src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsEditor.csproj

@ -1,87 +0,0 @@ @@ -1,87 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>ICSharpCode.SettingsEditor</RootNamespace>
<AssemblyName>SettingsEditor</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{85226AFB-CE71-4851-9A75-7EEC663A8E8A}</ProjectGuid>
<OutputPath>..\..\..\..\..\AddIns\AddIns\DisplayBindings\SettingsEditor\</OutputPath>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<Optimize>True</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
</ItemGroup>
<ItemGroup>
<None Include="SettingsEditor.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="SettingsDisplayBinding.cs" />
<Compile Include="SettingsViewContent.cs" />
<Compile Include="SettingsView.Designer.cs">
<DependentUpon>SettingsView.cs</DependentUpon>
</Compile>
<Compile Include="SettingsView.cs" />
<Compile Include="SettingsEntry.cs" />
<EmbeddedResource Include="SettingsView.resx">
<DependentUpon>SettingsView.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="ProxyPropertyDescriptor.cs" />
<Compile Include="SettingsEntryPropertyGridWrapper.cs" />
<Compile Include="ISettingsEntryHost.cs" />
<Compile Include="SpecialTypes.cs" />
<Compile Include="SettingsDocument.cs" />
<Compile Include="SettingsCodeGeneratorTool.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj">
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project>
<Name>ICSharpCode.SharpDevelop.Dom</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

293
src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsEntry.cs

@ -1,293 +0,0 @@ @@ -1,293 +0,0 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 10/28/2006
* Time: 11:16 PM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Xml;
using System.Configuration;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop;
namespace ICSharpCode.SettingsEditor
{
public enum SettingScope
{
Application, User
}
/// <summary>
/// Describes one settings entry. Used for binding to the DataGridView.
/// </summary>
public sealed class SettingsEntry : INotifyPropertyChanged
{
public const bool GenerateDefaultValueInCodeDefault = true;
string description;
bool generateDefaultValueInCode = GenerateDefaultValueInCodeDefault;
string name;
string provider = "";
bool roaming;
SettingScope scope = SettingScope.User;
Type type;
object value;
ISettingsEntryHost host;
[Obsolete("This constructor is required by the DataGridView, but not used because we " +
"use the BindingSourceAddingNew event. Use the overload specifying a host " +
"argument instead!")]
public SettingsEntry()
{
throw new NotSupportedException();
}
public SettingsEntry(ISettingsEntryHost host)
{
if (host == null)
throw new ArgumentNullException("host");
this.host = host;
}
public SettingsEntry(ISettingsEntryHost host, XmlElement element)
: this(host)
{
if (element == null)
throw new ArgumentNullException("element");
description = element.GetAttribute("Description");
if (!bool.TryParse(element.GetAttribute("GenerateDefaultValueInCode"), out generateDefaultValueInCode))
generateDefaultValueInCode = GenerateDefaultValueInCodeDefault;
name = element.GetAttribute("Name");
provider = element.GetAttribute("Provider");
bool.TryParse(element.GetAttribute("Roaming"), out roaming);
if ("Application".Equals(element.GetAttribute("Scope"), StringComparison.OrdinalIgnoreCase)) {
scope = SettingScope.Application;
} else {
scope = SettingScope.User;
}
type = GetType(element.GetAttribute("Type"));
this.SerializedValue = element["Value"].InnerText;
}
static SettingsPropertyValue GetSettingConverter(Type type, string name)
{
TypeConverter c = TypeDescriptor.GetConverter(type);
SettingsSerializeAs ssa;
if (c.CanConvertFrom(typeof(string)) && c.CanConvertTo(typeof(string))) {
ssa = SettingsSerializeAs.String;
} else {
ssa = SettingsSerializeAs.Xml;
}
SettingsProperty p = new SettingsProperty(name);
p.PropertyType = type;
p.SerializeAs = ssa;
return new SettingsPropertyValue(p);
}
public void WriteTo(XmlWriter writer)
{
writer.WriteStartElement("Setting");
writer.WriteAttributeString("Name", this.Name);
writer.WriteAttributeString("Type", this.SerializedSettingType);
writer.WriteAttributeString("Scope", this.Scope.ToString());
if (!string.IsNullOrEmpty(description)) {
writer.WriteAttributeString("Description", description);
}
if (generateDefaultValueInCode != GenerateDefaultValueInCodeDefault) {
writer.WriteAttributeString("GenerateDefaultValueInCode", XmlConvert.ToString(generateDefaultValueInCode));
}
if (!string.IsNullOrEmpty(provider)) {
writer.WriteAttributeString("Provider", provider);
}
if (scope == SettingScope.User) {
writer.WriteAttributeString("Roaming", XmlConvert.ToString(roaming));
}
writer.WriteStartElement("Value");
writer.WriteAttributeString("Profile", "(Default)");
writer.WriteValue(SerializedValue);
writer.WriteEndElement();
writer.WriteEndElement(); // Setting
}
Type GetType(string typeName)
{
foreach (SpecialTypeDescriptor d in SpecialTypeDescriptor.Descriptors) {
if (string.Equals(typeName, d.name, StringComparison.OrdinalIgnoreCase))
return d.type;
}
return typeof(object).Assembly.GetType(typeName, false)
?? typeof(Uri).Assembly.GetType(typeName, false)
?? typeof(System.Drawing.Font).Assembly.GetType(typeName, false)
?? typeof(System.Data.DataRow).Assembly.GetType(typeName, false);
}
[Browsable(false)]
public string Description {
get { return description; }
set {
description = value;
OnPropertyChanged(new PropertyChangedEventArgs("Description"));
}
}
[Browsable(false)]
public bool GenerateDefaultValueInCode {
get { return generateDefaultValueInCode; }
set {
generateDefaultValueInCode = value;
OnPropertyChanged(new PropertyChangedEventArgs("GenerateDefaultValueInCode"));
}
}
[LocalizedProperty("Name",
Description="Name of the setting.")]
public string Name {
get { return name; }
set {
if (string.IsNullOrEmpty(value))
throw new ArgumentException("The name is invalid.");
name = value;
OnPropertyChanged(new PropertyChangedEventArgs("Name"));
}
}
[Browsable(false)]
public string Provider {
get { return provider; }
set {
provider = value;
OnPropertyChanged(new PropertyChangedEventArgs("Provider"));
}
}
[Browsable(false)]
public bool Roaming {
get { return roaming; }
set {
roaming = value;
OnPropertyChanged(new PropertyChangedEventArgs("Roaming"));
}
}
public SettingScope Scope {
get { return scope; }
set {
scope = value;
OnPropertyChanged(new PropertyChangedEventArgs("Scope"));
}
}
public object Value {
get { return this.value; }
set {
if (type == null || value == null || type.IsInstanceOfType(value)) {
this.value = value;
cachedSerializedValue = null;
OnPropertyChanged(new PropertyChangedEventArgs("Value"));
OnPropertyChanged(new PropertyChangedEventArgs("SerializedValue"));
} else {
throw new ArgumentException("Invalid type for property value.");
}
}
}
string cachedSerializedValue;
public string SerializedValue {
get {
if (cachedSerializedValue != null)
return cachedSerializedValue;
if (type != null && type != typeof(string)) {
foreach (SpecialTypeDescriptor d in SpecialTypeDescriptor.Descriptors) {
if (type == d.type) {
return cachedSerializedValue = d.GetString(value);
}
}
SettingsPropertyValue v = GetSettingConverter(type, name);
v.PropertyValue = value;
cachedSerializedValue = (v.SerializedValue ?? "").ToString();
} else if (value != null) {
cachedSerializedValue = value.ToString();
} else {
cachedSerializedValue = "";
}
return cachedSerializedValue;
}
set {
if (type != null && type != typeof(string)) {
foreach (SpecialTypeDescriptor d in SpecialTypeDescriptor.Descriptors) {
if (type == d.type) {
this.Value = d.GetValue(value);
return;
}
}
SettingsPropertyValue v = GetSettingConverter(type, name);
v.SerializedValue = value;
this.Value = v.PropertyValue;
} else {
this.Value = value;
}
}
}
public Type Type {
get { return type; }
set {
if (type != value) {
string oldValue = this.SerializedValue;
this.cachedSerializedValue = null;
this.value = null;
type = value;
OnPropertyChanged(new PropertyChangedEventArgs("Type"));
OnPropertyChanged(new PropertyChangedEventArgs("WrappedSettingType"));
this.SerializedValue = oldValue;
}
}
}
[Browsable(false)]
public string SerializedSettingType {
get {
foreach (SpecialTypeDescriptor d in SpecialTypeDescriptor.Descriptors) {
if (type == d.type)
return d.name;
}
if (type != null)
return type.FullName;
else
return "(null)";
}
}
public string WrappedSettingType {
get {
return host.GetDisplayNameForType(type);
}
set {
this.Type = host.GetTypeByDisplayName(value);
}
}
public event PropertyChangedEventHandler PropertyChanged;
void OnPropertyChanged(PropertyChangedEventArgs e)
{
if (PropertyChanged != null) {
PropertyChanged(this, e);
}
}
}
}

148
src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsEntryPropertyGridWrapper.cs

@ -1,148 +0,0 @@ @@ -1,148 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.ComponentModel;
using System.Xml;
using System.Configuration;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SettingsEditor
{
/// <summary>
/// Wraps around one SettingsEntry. Used to bind to the property grid, supporting
/// type editor based on the setting's type.
/// </summary>
public sealed class SettingsEntryPropertyGridWrapper : LocalizedObject, INotifyPropertyChanged
{
readonly SettingsEntry entry;
public SettingsEntryPropertyGridWrapper(SettingsEntry entry)
{
if (entry == null)
throw new ArgumentNullException("entry");
this.entry = entry;
}
[LocalizedProperty("Description",
Description="Description of the setting.")]
public string Description {
get { return entry.Description; }
set { entry.Description = value; }
}
[LocalizedProperty("Generate default value in code",
Description="Specifies whether the value should be saved as attribute in the generated code.")]
[DefaultValue(SettingsEntry.GenerateDefaultValueInCodeDefault)]
public bool GenerateDefaultValueInCode {
get { return entry.GenerateDefaultValueInCode; }
set { entry.GenerateDefaultValueInCode = value; }
}
[LocalizedProperty("Name",
Description="Name of the setting.")]
public string Name {
get { return entry.Name; }
set { entry.Name = value; }
}
[LocalizedProperty("Provider",
Description="The provider used to manage the setting.")]
public string Provider {
get { return entry.Provider; }
set { entry.Provider = value; }
}
[LocalizedProperty("Roaming",
Description="Specifies whether changes to the setting are stored in 'Application Data' (Roaming=true) or 'Local Application Data' (Roaming=false)")]
public bool Roaming {
get { return entry.Roaming; }
set { entry.Roaming = value; }
}
[LocalizedProperty("Scope",
Description="Specifies whether the setting is per-application (read-only) or per-user (read/write).")]
public SettingScope Scope {
get { return entry.Scope; }
set { entry.Scope = value; }
}
[LocalizedProperty("SerializedSettingType",
Description="The type used for the setting in the strongly-typed settings class.")]
public string SerializedSettingType {
get { return entry.SerializedSettingType; }
}
[LocalizedProperty("Value",
Description="The default value of the setting.")]
public object Value {
get { return entry.Value; }
set { entry.Value = value; }
}
#region Custom property descriptors
protected override void FilterProperties(PropertyDescriptorCollection col)
{
base.FilterProperties(col);
PropertyDescriptor oldValue = col["Value"];
col.Remove(oldValue);
col.Add(new CustomValuePropertyDescriptor(oldValue, entry.Type ?? typeof(string)));
PropertyDescriptor oldRoaming = col["Roaming"];
col.Remove(oldRoaming);
col.Add(new RoamingPropertyDescriptor(oldRoaming, entry));
}
class RoamingPropertyDescriptor : ProxyPropertyDescriptor
{
SettingsEntry entry;
public RoamingPropertyDescriptor(PropertyDescriptor baseDescriptor, SettingsEntry entry)
: base(baseDescriptor)
{
if (entry == null)
throw new ArgumentNullException("entry");
this.entry = entry;
}
public override bool IsReadOnly {
get {
return entry.Scope == SettingScope.Application;
}
}
}
class CustomValuePropertyDescriptor : ProxyPropertyDescriptor
{
Type newPropertyType;
public CustomValuePropertyDescriptor(PropertyDescriptor baseDescriptor, Type newPropertyType)
: base(baseDescriptor)
{
if (newPropertyType == null)
throw new ArgumentNullException("newPropertyType");
this.newPropertyType = newPropertyType;
}
public override Type PropertyType {
get {
return newPropertyType;
}
}
public override object GetEditor(Type editorBaseType)
{
return TypeDescriptor.GetEditor(newPropertyType, editorBaseType);
}
}
#endregion
public event PropertyChangedEventHandler PropertyChanged {
add { entry.PropertyChanged += value; }
remove { entry.PropertyChanged -= value; }
}
}
}

140
src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.Designer.cs generated

@ -1,140 +0,0 @@ @@ -1,140 +0,0 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 10/28/2006
* Time: 5:54 PM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
namespace ICSharpCode.SettingsEditor
{
partial class SettingsView
{
/// <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.components = new System.ComponentModel.Container();
this.grid = new System.Windows.Forms.DataGridView();
this.bindingSource = new System.Windows.Forms.BindingSource(this.components);
this.label1 = new System.Windows.Forms.Label();
this.NameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.TypeColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
this.ScopeColumn = new System.Windows.Forms.DataGridViewComboBoxColumn();
this.ValueColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.grid)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource)).BeginInit();
this.SuspendLayout();
//
// grid
//
this.grid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.grid.AutoGenerateColumns = false;
this.grid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.grid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.NameColumn,
this.TypeColumn,
this.ScopeColumn,
this.ValueColumn});
this.grid.DataSource = this.bindingSource;
this.grid.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter;
this.grid.Location = new System.Drawing.Point(3, 38);
this.grid.Name = "grid";
this.grid.Size = new System.Drawing.Size(480, 321);
this.grid.TabIndex = 0;
this.grid.DataError += new System.Windows.Forms.DataGridViewDataErrorEventHandler(this.GridDataError);
this.grid.SelectionChanged += new System.EventHandler(this.GridSelectionChanged);
//
// bindingSource
//
this.bindingSource.DataSource = typeof(ICSharpCode.SettingsEditor.SettingsEntry);
this.bindingSource.AddingNew += new System.ComponentModel.AddingNewEventHandler(this.BindingSourceAddingNew);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(4, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(292, 13);
this.label1.TabIndex = 1;
this.label1.Text = "SettingsView prototype. Code generation not implemented!";
//
// NameColumn
//
this.NameColumn.DataPropertyName = "Name";
this.NameColumn.HeaderText = "Name";
this.NameColumn.MinimumWidth = 50;
this.NameColumn.Name = "NameColumn";
//
// TypeColumn
//
this.TypeColumn.DataPropertyName = "WrappedSettingType";
this.TypeColumn.DropDownWidth = 255;
this.TypeColumn.HeaderText = "Type";
this.TypeColumn.MinimumWidth = 50;
this.TypeColumn.Name = "TypeColumn";
this.TypeColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
//
// ScopeColumn
//
this.ScopeColumn.DataPropertyName = "Scope";
this.ScopeColumn.DropDownWidth = 80;
this.ScopeColumn.HeaderText = "Scope";
this.ScopeColumn.MinimumWidth = 30;
this.ScopeColumn.Name = "ScopeColumn";
this.ScopeColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
//
// ValueColumn
//
this.ValueColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.ValueColumn.DataPropertyName = "SerializedValue";
this.ValueColumn.HeaderText = "Value";
this.ValueColumn.MinimumWidth = 50;
this.ValueColumn.Name = "ValueColumn";
//
// SettingsView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label1);
this.Controls.Add(this.grid);
this.Name = "SettingsView";
this.Size = new System.Drawing.Size(486, 362);
((System.ComponentModel.ISupportInitialize)(this.grid)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bindingSource)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.DataGridViewComboBoxColumn TypeColumn;
private System.Windows.Forms.DataGridViewComboBoxColumn ScopeColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn ValueColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn NameColumn;
private System.Windows.Forms.BindingSource bindingSource;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.DataGridView grid;
}
}

173
src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.cs

@ -1,173 +0,0 @@ @@ -1,173 +0,0 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 10/28/2006
* Time: 5:54 PM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop;
namespace ICSharpCode.SettingsEditor
{
public partial class SettingsView : UserControl, ISettingsEntryHost
{
public event EventHandler SelectionChanged;
public event EventHandler SettingsChanged;
static readonly Type[] defaultAvailableTypes = new Type[] {
typeof(bool),
typeof(byte),
typeof(char),
typeof(decimal),
typeof(double),
typeof(float),
typeof(int),
typeof(long),
typeof(sbyte),
typeof(short),
typeof(string),
typeof(System.Collections.Specialized.StringCollection),
typeof(System.DateTime),
typeof(System.Drawing.Color),
typeof(System.Drawing.Font),
typeof(System.Drawing.Point),
typeof(System.Drawing.Size),
typeof(System.Guid),
typeof(System.TimeSpan),
typeof(uint),
typeof(ulong),
typeof(ushort)
};
List<string> typeNames = new List<string>();
List<Type> types = new List<Type>();
IAmbience ambience;
public SettingsView()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
ambience = AmbienceService.GetCurrentAmbience();
foreach (Type type in defaultAvailableTypes) {
types.Add(type);
typeNames.Add(ambience.GetIntrinsicTypeName(type.FullName));
}
foreach (SpecialTypeDescriptor d in SpecialTypeDescriptor.Descriptors) {
types.Add(d.type);
typeNames.Add(d.name);
}
ScopeColumn.DataSource = Enum.GetValues(typeof(SettingScope));
TypeColumn.DataSource = typeNames;
}
public void ShowEntries(IList<SettingsEntry> list)
{
foreach (SettingsEntry entry in list) {
bindingSource.Add(entry);
}
bindingSource.ListChanged += delegate(object sender, ListChangedEventArgs e) {
if (e.NewIndex >= 0 && e.NewIndex < bindingSource.Count) {
if (((SettingsEntry)bindingSource[e.NewIndex]).Name != null) {
if (SettingsChanged != null) {
SettingsChanged(this, e);
}
}
}
};
}
void GridSelectionChanged(object sender, EventArgs e)
{
if (SelectionChanged != null)
SelectionChanged(this, e);
}
public IEnumerable<SettingsEntry> GetAllEntries()
{
List<SettingsEntry> l = new List<SettingsEntry>();
foreach (SettingsEntry entry in bindingSource) {
if (!string.IsNullOrEmpty(entry.Name)) {
l.Add(entry);
}
}
l.Sort(delegate(SettingsEntry a, SettingsEntry b) {
return a.Name.CompareTo(b.Name);
});
return l;
}
public List<SettingsEntryPropertyGridWrapper> GetSelectedEntriesForPropertyGrid()
{
List<SettingsEntryPropertyGridWrapper> l
= new List<SettingsEntryPropertyGridWrapper>();
if (grid.SelectedRows.Count > 0) {
foreach (DataGridViewRow row in grid.SelectedRows) {
if (row.DataBoundItem != null) {
l.Add(new SettingsEntryPropertyGridWrapper((SettingsEntry)row.DataBoundItem));
}
}
} else {
bool[] rowAdded = new bool[grid.Rows.Count];
foreach (DataGridViewCell cell in grid.SelectedCells) {
if (rowAdded[cell.RowIndex] == false) {
rowAdded[cell.RowIndex] = true;
if (cell.OwningRow.DataBoundItem != null) {
l.Add(new SettingsEntryPropertyGridWrapper((SettingsEntry)cell.OwningRow.DataBoundItem));
}
}
}
}
return l;
}
void BindingSourceAddingNew(object sender, AddingNewEventArgs e)
{
SettingsEntry entry = new SettingsEntry(this);
entry.Type = typeof(string);
e.NewObject = entry;
}
void GridDataError(object sender, DataGridViewDataErrorEventArgs e)
{
LoggingService.Debug("Row " + e.RowIndex + ", column " + e.ColumnIndex + ", error " + e.Exception.ToString());
if (e.Exception != null) {
MessageBox.Show("Error in data entry: " + e.Exception.Message);
} else {
MessageBox.Show("Error in data entry");
}
}
string ISettingsEntryHost.GetDisplayNameForType(Type type)
{
foreach (SpecialTypeDescriptor d in SpecialTypeDescriptor.Descriptors) {
if (type == d.type)
return d.name;
}
return ambience.GetIntrinsicTypeName(type.FullName);
}
Type ISettingsEntryHost.GetTypeByDisplayName(string displayName)
{
for (int i = 0; i < typeNames.Count; i++) {
if (typeNames[i] == displayName)
return types[i];
}
return null;
}
}
}

126
src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsView.resx

@ -1,126 +0,0 @@ @@ -1,126 +0,0 @@
<?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>
<metadata name="TypeColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="bindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>28, 18</value>
</metadata>
</root>

97
src/AddIns/DisplayBindings/SettingsEditor/Project/SettingsViewContent.cs

@ -1,97 +0,0 @@ @@ -1,97 +0,0 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 10/28/2006
* Time: 5:54 PM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using System.Xml;
using System.Text;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SettingsEditor
{
public class SettingsViewContent : AbstractViewContent, IHasPropertyContainer
{
SettingsView view = new SettingsView();
PropertyContainer propertyContainer = new PropertyContainer();
SettingsDocument setDoc = new SettingsDocument();
public SettingsViewContent(OpenedFile file) : base(file)
{
view.SelectionChanged += delegate {
propertyContainer.SelectedObjects = view.GetSelectedEntriesForPropertyGrid().ToArray();
};
view.SettingsChanged += delegate {
this.PrimaryFile.MakeDirty();
};
}
public override Control Control {
get {
return view;
}
}
public override void Load(OpenedFile file, Stream stream)
{
if (file == PrimaryFile) {
try {
XmlDocument doc = new XmlDocument();
doc.Load(stream);
setDoc = new SettingsDocument(doc.DocumentElement, view);
view.ShowEntries(setDoc.Entries);
} catch (XmlException ex) {
ShowLoadError(ex.Message);
}
}
}
void ShowLoadError(string message)
{
MessageService.ShowMessage(message);
if (this.WorkbenchWindow != null) {
this.WorkbenchWindow.CloseWindow(true);
}
}
public override void Save(OpenedFile file, Stream stream)
{
if (file == PrimaryFile) {
using (XmlTextWriter writer = new XmlTextWriter(stream, Encoding.UTF8)) {
writer.Formatting = Formatting.Indented;
writer.WriteStartDocument();
setDoc.Entries.Clear();
setDoc.Entries.AddRange(view.GetAllEntries());
setDoc.Save(writer);
writer.WriteEndDocument();
}
}
}
public PropertyContainer PropertyContainer {
get {
return propertyContainer;
}
}
public override void Dispose()
{
propertyContainer.Clear();
base.Dispose();
}
}
}

72
src/AddIns/DisplayBindings/SettingsEditor/Project/SpecialTypes.cs

@ -1,72 +0,0 @@ @@ -1,72 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.ComponentModel;
using System.Reflection;
using System.Configuration;
namespace ICSharpCode.SettingsEditor
{
sealed class SpecialTypeDescriptor
{
internal string name;
internal Type type;
internal SpecialSetting specialSetting;
internal SpecialTypeDescriptor(string name, Type type, SpecialSetting specialSetting)
{
this.name = name;
this.type = type;
this.specialSetting = specialSetting;
}
public string GetString(object value)
{
if (value == null)
return "";
else
return type.InvokeMember("name",
BindingFlags.GetField | BindingFlags.Instance | BindingFlags.Public,
null, value, null) as string ?? "";
}
public object GetValue(string text)
{
return Activator.CreateInstance(type, text);
}
internal static readonly SpecialTypeDescriptor[] Descriptors = {
new SpecialTypeDescriptor("(Web Service URL)",
typeof(WebServiceUrlDummyType),
SpecialSetting.WebServiceUrl),
new SpecialTypeDescriptor("(Connection string)",
typeof(ConnectionStringDummyType),
SpecialSetting.ConnectionString)
};
}
sealed class WebServiceUrlDummyType
{
public string name;
public WebServiceUrlDummyType(string name)
{
this.name = name;
}
}
sealed class ConnectionStringDummyType
{
public string name;
public ConnectionStringDummyType(string name)
{
this.name = name;
}
}
}

22
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Configuration/AssemblyInfo.cs

@ -1,22 +0,0 @@ @@ -1,22 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
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("WorkflowDesigner")]
[assembly: AssemblyDescription("Windows Workflow Foundation Addin for SharpDevelop 3.0")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

45
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Gui/ViewContentControl.Designer.cs generated

@ -1,45 +0,0 @@ @@ -1,45 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
namespace WorkflowDesigner
{
partial class ViewContentControl
{
/// <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()
{
//
// ViewContentControl
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "ViewContentControl";
}
}
}

222
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Gui/ViewContentControl.cs

@ -1,222 +0,0 @@ @@ -1,222 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
#region Using
using System;
using System.ComponentModel.Design;
using System.Collections;
using System.Windows.Forms;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Activities;
using System.ComponentModel.Design.Serialization;
using System.IO;
using System.Drawing.Design;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop;
using ICSharpCode.TextEditor;
using ICSharpCode.TextEditor.Document;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using WorkflowDesigner.Loaders;
#endregion
namespace WorkflowDesigner
{
/// <summary>
/// Description of ViewContentControl.
/// </summary>
public partial class ViewContentControl : UserControl, IHasPropertyContainer
{
private DesignSurface designSurface;
private BasicDesignerLoader loader;
private IViewContent viewContent;
private bool addedSideTab;
public ViewContentControl(IViewContent viewContent)
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
this.viewContent = viewContent;
}
public IDesignerHost DesignerHost {
get {
if (designSurface == null)
return null;
return (IDesignerHost)designSurface.GetService(typeof(IDesignerHost));
}
}
public IRootDesigner RootDesigner
{
get
{
return DesignerHost.GetDesigner(DesignerHost.RootComponent) as IRootDesigner;
}
}
public WorkflowView WorkflowView
{
get
{
return (WorkflowView)RootDesigner.GetView(ViewTechnology.Default);
}
}
internal void LoadWorkflow(BasicDesignerLoader loader)
{
StatusBarService.SetMessage("Loading workflow " + Path.GetFileName(viewContent.PrimaryFileName) + "...");
Application.UseWaitCursor = true;
Application.DoEvents();
if (!addedSideTab){
WorkflowSideTabService.AddViewContent(this.viewContent);
addedSideTab = true;
}
this.loader = loader;
try {
LoadDesigner();
if (designSurface != null && Controls.Count == 0) {
Control designer = designSurface.View as Control;
designer.Dock = DockStyle.Fill;
Controls.Add(designer);
DesignerHost.Activate();
}
} catch (Exception e) {
TextBox errorText = new TextBox();
errorText.Multiline = true;
errorText.ScrollBars = ScrollBars.Both;
if (!designSurface.IsLoaded && designSurface.LoadErrors != null) {
errorText.Text = "Error loading designer:\r\n\r\n";
foreach(Exception le in designSurface.LoadErrors) {
errorText.Text += le.ToString();
errorText.Text += "\r\n";
}
} else {
errorText.Text = e.ToString();
}
errorText.Dock = DockStyle.Fill;
Controls.Add(errorText);
errorText.BringToFront();
Control title = new Label();
title.Text = "Failed to load designer. Check the source code for syntax errors and check if all references are available.";
title.Dock = DockStyle.Top;
Controls.Add(title);
} finally {
StatusBarService.SetMessage(String.Empty);
Application.UseWaitCursor = false;
}
}
internal void SaveWorkflow(Stream stream)
{
loader.Flush();
if (loader is XomlDesignerLoader) {
using (StreamWriter w = new StreamWriter(stream)) {
w.Write(((XomlDesignerLoader)loader).Xoml);
}
}
}
internal void UnloadWorkflow()
{
UnloadDesigner();
}
void UnloadDesigner()
{
this.Controls.Clear();
designSurface.Dispose();
designSurface = null;
}
void LoadDesigner()
{
designSurface = new DesignSurface();
designSurface.BeginLoad(loader);
// Monitor for updates and make the view dirty.
IComponentChangeService componentChangeService = (IComponentChangeService)designSurface.GetService(typeof(IComponentChangeService));
//componentChangeService.ComponentAdding += new ComponentEventHandler(ComponentAddingHandler);
componentChangeService.ComponentAdded += new ComponentEventHandler(ComponentAddedHandler);
componentChangeService.ComponentChanged += new ComponentChangedEventHandler(ComponentChangedHandler);
// Attach the selection service to capture objects selection changes to update property pad.
ISelectionService selectionService = (ISelectionService)designSurface.GetService(typeof(ISelectionService));
selectionService.SelectionChanged += new EventHandler(SelectionChangedHandler);
}
void ComponentAddedHandler(object sender, ComponentEventArgs args)
{
viewContent.PrimaryFile.MakeDirty();
LoggingService.Debug("ComponentAddedHandler");
}
void ComponentAddingHandler(object sender, ComponentEventArgs args)
{
LoggingService.Debug("ComponentAddingHandler");
}
void ComponentChangedHandler(object sender, ComponentChangedEventArgs args)
{
viewContent.PrimaryFile.MakeDirty();
ISelectionService selectionService = (ISelectionService)designSurface.GetService(typeof(ISelectionService));
UpdatePropertyPadSelection(selectionService);
}
void SelectionChangedHandler(object sender, EventArgs args)
{
UpdatePropertyPadSelection((ISelectionService)sender);
}
void UpdatePropertyPadSelection(ISelectionService selectionService)
{
ICollection selection = selectionService.GetSelectedComponents();
object[] selArray = new object[selection.Count];
selection.CopyTo(selArray, 0);
propertyContainer.SelectableObjects = DesignerHost.Container.Components;
propertyContainer.Host = DesignerHost;
propertyContainer.SelectedObjects = selArray;
}
internal void Deselected()
{
propertyContainer.SelectableObjects = null;
propertyContainer.Host = null;
propertyContainer.SelectedObjects = null;
}
#region IHasPropertyContainer
PropertyContainer propertyContainer = new PropertyContainer();
public PropertyContainer PropertyContainer {
get {
return propertyContainer;
}
}
#endregion
}
}

152
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Loaders/BasicWorkflowDesignerLoader.cs

@ -1,152 +0,0 @@ @@ -1,152 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
#region Using
using System;
using System.ComponentModel.Design;
using System.ComponentModel.Design.Serialization;
using System.Drawing.Design;
using System.Globalization;
using System.IO;
using System.Text;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Compiler;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
#endregion
namespace WorkflowDesigner.Loaders
{
/// <summary>
/// Description of BasicWorkflowDesignerLoader.
/// </summary>
public abstract class BasicWorkflowDesignerLoader : WorkflowDesignerLoader
{
private IViewContent viewContent;
private string ruleFileName;
private StringBuilder rules;
protected BasicWorkflowDesignerLoader(IViewContent viewContent)
{
this.viewContent = viewContent;
ruleFileName = Path.Combine(Path.GetDirectoryName(FileName),
Path.GetFileNameWithoutExtension(FileName) + ".rules");
}
#region Property Accessors
public IViewContent ViewContent {
get { return viewContent; }
}
public override string FileName {
get {
return viewContent.PrimaryFileName;
}
}
public IProject Project {
get {
return ProjectService.OpenSolution.FindProjectContainingFile(FileName);
}
}
#endregion
public override TextReader GetFileReader(string filePath)
{
return new StringReader(rules.ToString());
}
public override TextWriter GetFileWriter(string filePath)
{
if (rules == null) {
rules = new StringBuilder();
CreateRulesProjectItem();
}
return new StringWriter(rules, CultureInfo.CurrentCulture);
}
private void LoadRules()
{
// Load the rules
if (File.Exists(ruleFileName)) {
rules = new StringBuilder(File.ReadAllText(ruleFileName));
CreateRulesProjectItem();
}
}
private void UpdateRules()
{
if ((rules != null) && (rules.Length > 0))
File.WriteAllText(ruleFileName, rules.ToString());
}
private void CreateRulesProjectItem()
{
if (Project != null){
if (!Project.IsFileInProject(ruleFileName)) {
FileProjectItem rfpi = new FileProjectItem(Project,ItemType.EmbeddedResource);
rfpi.FileName = Path.Combine(Path.GetDirectoryName(FileName), Path.GetFileName(ruleFileName));
rfpi.DependentUpon = Path.GetFileName(FileName);
ProjectService.AddProjectItem(Project, rfpi);
ProjectBrowserPad.Instance.ProjectBrowserControl.RefreshView();
Project.Save();
}
}
}
protected override void Initialize()
{
base.Initialize();
// Add the basic service required by all designers
LoaderHost.AddService(typeof(IToolboxService), new WorkflowToolboxService(LoaderHost));
LoaderHost.AddService(typeof(ITypeProvider), TypeProviderService.GetTypeProvider(Project));
LoaderHost.AddService(typeof(IMenuCommandService), new WorkflowMenuCommandService(LoaderHost));
LoaderHost.AddService(typeof(ITypeResolutionService), new TypeResolutionService(Project,LoaderHost));
LoaderHost.AddService(typeof(IPropertyValueUIService), new PropertyValueUIService());
}
public override void Dispose()
{
try {
// Remove all the services from the from the host designer.
if (LoaderHost != null) {
LoaderHost.RemoveService(typeof(IToolboxService));
LoaderHost.RemoveService(typeof(ITypeProvider));
LoaderHost.RemoveService(typeof(IEventBindingService));
LoaderHost.RemoveService(typeof(IMenuCommandService));
LoaderHost.RemoveService(typeof(IPropertyValueUIService));
LoaderHost.RemoveService(typeof(ITypeResolutionService));
LoaderHost.RemoveService(typeof(IMemberCreationService));
}
} finally {
base.Dispose();
}
}
protected override void PerformLoad(IDesignerSerializationManager serializationManager)
{
DoPerformLoad(serializationManager);
LoadRules();
}
protected abstract void DoPerformLoad(IDesignerSerializationManager serializationManager);
protected override void PerformFlush(IDesignerSerializationManager serializationManager)
{
DoPerformFlush(serializationManager);
UpdateRules();
}
protected abstract void DoPerformFlush(IDesignerSerializationManager serializationManager);
}
}

290
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Loaders/CodeDesignerLoader.cs

@ -1,290 +0,0 @@ @@ -1,290 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
#region Using
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.ComponentModel.Design.Serialization;
using System.IO;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.Ast;
using ICSharpCode.NRefactory.Visitors;
#endregion
namespace WorkflowDesigner.Loaders
{
/// <summary>
/// Description of CodeDesignerLoader.
/// </summary>
public class CodeDesignerLoader : BasicWorkflowDesignerLoader
{
public CodeDesignerLoader(IViewContent viewContent) : base(viewContent)
{
}
protected override void Initialize()
{
base.Initialize();
LoaderHost.AddService(typeof(IMemberCreationService), new MemberCreationService(LoaderHost));
LoaderHost.AddService(typeof(CodeDomProvider), Project.LanguageProperties.CodeDomProvider);
LoaderHost.AddService(typeof(IEventBindingService), new CSharpWorkflowDesignerEventBindingService(LoaderHost, ViewContent.PrimaryFileName));
}
protected override void DoPerformLoad(IDesignerSerializationManager serializationManager)
{
// Step 1, Get the CodeDom
CodeCompileUnit ccu = Parse();
// Step 2, Find the first class
CodeTypeDeclaration codeTypeDeclaration = ccu.Namespaces[0].Types[0];
TypeResolutionService typeResolutionService = GetService(typeof(ITypeResolutionService)) as TypeResolutionService;
Type baseType = typeResolutionService.GetType(codeTypeDeclaration.BaseTypes[0].BaseType);
if (baseType == null)
throw new WorkflowDesignerLoadException("Unable to resolve type " + codeTypeDeclaration.BaseTypes[0].BaseType);
// Step 3, Deserialize it!
TypeCodeDomSerializer serializer = serializationManager.GetSerializer(baseType, typeof(TypeCodeDomSerializer)) as TypeCodeDomSerializer;
#if DEBUG
Project.LanguageProperties.CodeDomProvider.GenerateCodeFromType(codeTypeDeclaration, Console.Out, null);
#endif
// Step 4, load up the designer.
Activity rootActivity = serializer.Deserialize(serializationManager, codeTypeDeclaration) as Activity;
// FIXME: This is a workaraound as the deserializer does not appear to add the
// components to the container with the activity.name so
// the designer complains the name is already used when the
// name of an activity is the same as a field name in the workflow!
// When I work out how the IMemberCreationService fits into
// the scheme of things this will probably go away!
// (Worth noting CodeDomDesignerLoader has the same problem!)
//int i = 0;
foreach(IComponent c in LoaderHost.Container.Components) {
if (c is Activity) {
LoaderHost.Container.Remove(c);
LoaderHost.Container.Add(c, ((Activity)c).Name);
}
}
SetBaseComponentClassName(ccu.Namespaces[0].Name + "." + codeTypeDeclaration.Name);
}
protected override void DoPerformFlush(IDesignerSerializationManager serializationManager)
{
// TODO: Update the InitializeComponent() method here.
}
#region Taken from FormDesigner.NRefactoryDesignerLoad to get a single CodeCompileUnit for the activity.
protected CodeCompileUnit Parse()
{
ParseInformation parseInfo = ParserService.GetParseInformation(FileName);
IClass formClass;
bool isFirstClassInFile;
IList<IClass> parts = FindFormClassParts(parseInfo, out formClass, out isFirstClassInFile);
const string missingReferenceMessage = "Your project is missing a reference to '${Name}' - please add it using 'Project > Add Reference'.";
if (formClass.ProjectContent.GetClass("System.Workflow.Activities.CodeActivity", 0) == null) {
throw new WorkflowDesignerLoadException(
StringParser.Parse(
missingReferenceMessage, new string[,] {{ "Name" , "System.Workflow.Activities"}}
));
}
List<KeyValuePair<string, CompilationUnit>> compilationUnits = new List<KeyValuePair<string, CompilationUnit>>();
bool foundInitMethod = false;
foreach (IClass part in parts) {
string fileName = part.CompilationUnit.FileName;
if (fileName == null) continue;
bool found = false;
foreach (KeyValuePair<string, CompilationUnit> entry in compilationUnits) {
if (FileUtility.IsEqualFileName(fileName, entry.Key)) {
found = true;
break;
}
}
if (found) continue;
string fileContent = ParserService.GetParseableFileContent(fileName);
ICSharpCode.NRefactory.IParser p = ICSharpCode.NRefactory.ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(fileContent));
p.Parse();
if (p.Errors.Count > 0) {
throw new WorkflowDesignerLoadException("Syntax errors in " + fileName + ":\r\n" + p.Errors.ErrorOutput);
}
// Try to fix the type names to fully qualified ones
FixTypeNames(p.CompilationUnit, part.CompilationUnit, ref foundInitMethod);
compilationUnits.Add(new KeyValuePair<string, CompilationUnit>(fileName, p.CompilationUnit));
}
if (!foundInitMethod)
throw new WorkflowDesignerLoadException("The InitializeComponent method was not found. Designer cannot be loaded.");
CompilationUnit combinedCu = new CompilationUnit();
NamespaceDeclaration nsDecl = new NamespaceDeclaration(formClass.Namespace);
combinedCu.AddChild(nsDecl);
TypeDeclaration formDecl = new TypeDeclaration(Modifiers.Public, null);
nsDecl.AddChild(formDecl);
formDecl.Name = formClass.Name;
foreach (KeyValuePair<string, CompilationUnit> entry in compilationUnits) {
foreach (object o in entry.Value.Children) {
TypeDeclaration td = o as TypeDeclaration;
if (td != null && td.Name == formDecl.Name) {
foreach (INode node in td.Children)
formDecl.AddChild(node);
formDecl.BaseTypes.AddRange(td.BaseTypes);
}
if (o is NamespaceDeclaration) {
foreach (object o2 in ((NamespaceDeclaration)o).Children) {
td = o2 as TypeDeclaration;
if (td != null && td.Name == formDecl.Name) {
foreach (INode node in td.Children)
formDecl.AddChild(node);
formDecl.BaseTypes.AddRange(td.BaseTypes);
}
}
}
}
}
CodeDomVisitor visitor = new CodeDomVisitor();
visitor.EnvironmentInformationProvider = new ICSharpCode.SharpDevelop.Dom.NRefactoryResolver.NRefactoryInformationProvider(formClass.ProjectContent);
visitor.VisitCompilationUnit(combinedCu, null);
if (!isFirstClassInFile) {
MessageService.ShowWarning("The form must be the first class in the file in order for form resources be compiled correctly.\n" +
"Please move other classes below the form class definition or move them to other files.");
}
return visitor.codeCompileUnit;
}
public static IList<IClass> FindFormClassParts(ParseInformation parseInfo, out IClass formClass, out bool isFirstClassInFile)
{
formClass = null;
isFirstClassInFile = true;
foreach (IClass c in parseInfo.BestCompilationUnit.Classes) {
if (WorkflowDesignerSecondaryDisplayBinding.BaseClassIsWorkflow(c)) {
formClass = c;
break;
}
isFirstClassInFile = false;
}
if (formClass == null)
throw new WorkflowDesignerLoadException("No class derived from Form or UserControl was found.");
// Initialize designer for formClass
formClass = formClass.GetCompoundClass();
if (formClass is CompoundClass) {
return (formClass as CompoundClass).Parts;
} else {
return new IClass[] { formClass };
}
}
/// <summary>
/// Fix type names and remove unused methods.
/// </summary>
public static void FixTypeNames(object o, ICSharpCode.SharpDevelop.Dom.ICompilationUnit domCu, ref bool foundInitMethod)
{
if (domCu == null)
return;
CompilationUnit cu = o as CompilationUnit;
if (cu != null) {
foreach (object c in cu.Children) {
FixTypeNames(c, domCu, ref foundInitMethod);
}
return;
}
NamespaceDeclaration namespaceDecl = o as NamespaceDeclaration;
if (namespaceDecl != null) {
foreach (object c in namespaceDecl.Children) {
FixTypeNames(c, domCu, ref foundInitMethod);
}
return;
}
TypeDeclaration typeDecl = o as TypeDeclaration;
if (typeDecl != null) {
foreach (TypeReference tref in typeDecl.BaseTypes) {
FixTypeReference(tref, typeDecl.StartLocation, domCu);
}
for (int i = 0; i < typeDecl.Children.Count; i++) {
object child = typeDecl.Children[i];
MethodDeclaration method = child as MethodDeclaration;
if (method != null) {
// remove all methods except InitializeComponents
if ((method.Name == "InitializeComponents" || method.Name == "InitializeComponent") && method.Parameters.Count == 0) {
method.Name = "InitializeComponent";
if (foundInitMethod) {
throw new WorkflowDesignerLoadException("There are multiple InitializeComponent methods in the class. Designer cannot be loaded.");
}
foundInitMethod = true;
} else {
typeDecl.Children.RemoveAt(i--);
}
} else if (child is TypeDeclaration || child is FieldDeclaration) {
FixTypeNames(child, domCu, ref foundInitMethod);
} else {
// child is property, event etc.
typeDecl.Children.RemoveAt(i--);
}
}
return;
}
FieldDeclaration fieldDecl = o as FieldDeclaration;
if (fieldDecl != null) {
FixTypeReference(fieldDecl.TypeReference, fieldDecl.StartLocation, domCu);
foreach (VariableDeclaration var in fieldDecl.Fields) {
if (var != null) {
FixTypeReference(var.TypeReference, fieldDecl.StartLocation, domCu);
}
}
}
}
public static void FixTypeReference(TypeReference type, Location location, ICSharpCode.SharpDevelop.Dom.ICompilationUnit domCu)
{
if (type == null)
return;
if (type.SystemType != type.Type)
return;
foreach (TypeReference tref in type.GenericTypes) {
FixTypeReference(tref, location, domCu);
}
ICSharpCode.SharpDevelop.Dom.IClass curType = domCu.GetInnermostClass(location.Y, location.X);
ICSharpCode.SharpDevelop.Dom.IReturnType rt = domCu.ProjectContent.SearchType(new SearchTypeRequest(type.Type, type.GenericTypes.Count, curType, domCu, location.Y, location.X)).Result;
if (rt != null) {
type.Type = rt.FullyQualifiedName;
}
}
#endregion
}
}

35
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Loaders/WorkflowDesignerLoadException.cs

@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Runtime.Serialization;
namespace WorkflowDesigner.Loaders
{
/// <summary>
/// Description of WorkflowDesignerLoaderException.
/// </summary>
[Serializable()]
public class WorkflowDesignerLoadException : Exception
{
public WorkflowDesignerLoadException() : base()
{
}
public WorkflowDesignerLoadException(string message) : base(message)
{
}
public WorkflowDesignerLoadException(string message, Exception innerException) : base(message, innerException)
{
}
protected WorkflowDesignerLoadException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
}
}

137
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Loaders/XomlDesignerLoader.cs

@ -1,137 +0,0 @@ @@ -1,137 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
#region Using
using System;
using System.Globalization;
using System.Text;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Compiler;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.ComponentModel.Design.Serialization;
using System.Xml;
using System.Reflection;
using System.Drawing.Design;
using System.IO;
using System.Collections;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
#endregion
namespace WorkflowDesigner.Loaders
{
enum AuthoringMode {
NoCode,
CodeSeparation
}
/// <summary>
/// Description of XomlDesignerLoader.
/// </summary>
public class XomlDesignerLoader : BasicWorkflowDesignerLoader
{
private AuthoringMode authoringMode = AuthoringMode.NoCode;
private string xoml;
private string codeBesideFileName;
public XomlDesignerLoader(IViewContent viewContent) : base(viewContent)
{
// Look for a code beside file for CodeSeparation mode.
if (Project != null) {
FileProjectItem fpi = Project.FindFile(FileName);
string codeFileName = FileName + "." + Project.LanguageProperties.CodeDomProvider.FileExtension;
FileProjectItem dfpi = Project.FindFile(codeFileName);
if (dfpi.DependentUpon == Path.GetFileName(fpi.VirtualName)) {
authoringMode = AuthoringMode.CodeSeparation;
codeBesideFileName = codeFileName;
}
}
}
public XomlDesignerLoader(IViewContent viewContent, Stream stream) : this(viewContent)
{
Encoding encoding = ICSharpCode.SharpDevelop.ParserService.DefaultFileEncoding;
xoml = ICSharpCode.TextEditor.Util.FileReader.ReadFileContent(stream, ref encoding);
}
public string Xoml {
get { return xoml; }
set { xoml = value; }
}
protected override void Initialize()
{
base.Initialize();
// Install the additional services into the designer.
if (authoringMode == AuthoringMode.CodeSeparation) {
LoaderHost.AddService(typeof(IMemberCreationService), new MemberCreationService(LoaderHost));
LoaderHost.AddService(typeof(IEventBindingService), new CSharpWorkflowDesignerEventBindingService(LoaderHost,codeBesideFileName));
}
}
protected override void DoPerformFlush(IDesignerSerializationManager serializationManager)
{
Activity rootActivity = LoaderHost.RootComponent as Activity;
if (rootActivity != null) {
StringBuilder sb = new StringBuilder();
XmlTextWriter xmlWriter = new XmlTextWriter(new StringWriter(sb, CultureInfo.CurrentCulture));
try {
WorkflowMarkupSerializer xomlSerializer = new WorkflowMarkupSerializer();
xomlSerializer.Serialize(serializationManager, xmlWriter, rootActivity);
xoml = sb.ToString();
} finally {
xmlWriter.Close();
}
}
}
protected override void DoPerformLoad(IDesignerSerializationManager serializationManager)
{
LoadXoml(serializationManager);
}
protected void LoadXoml(IDesignerSerializationManager serializationManager)
{
// get the root activity from the xml.
XmlReader reader = new XmlTextReader(new StringReader(xoml));
Activity rootActivity = null;
try {
WorkflowMarkupSerializer xomlSerializer = new WorkflowMarkupSerializer();
rootActivity = xomlSerializer.Deserialize(serializationManager, reader) as Activity;
} finally {
reader.Close();
}
LoaderHost.Container.Add(rootActivity, rootActivity.QualifiedName);
CompositeActivity compositeActivity = rootActivity as CompositeActivity;
if (compositeActivity != null)
AddChildren(compositeActivity);
SetBaseComponentClassName(rootActivity.GetValue(WorkflowMarkupSerializer.XClassProperty) as string);
}
protected void AddChildren(CompositeActivity compositeActivity)
{
foreach (Activity activity in compositeActivity.Activities) {
LoaderHost.Container.Add(activity, activity.QualifiedName);
CompositeActivity compositeActivity2 = activity as CompositeActivity;
if (compositeActivity2 != null)
AddChildren(compositeActivity2);
}
}
}
}

36
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/PrimaryView/PrimaryDisplayBinding.cs

@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
#region Using
using System;
using System.IO;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
#endregion
namespace WorkflowDesigner
{
/// <summary>
/// Description of PrimaryDisplayBinding.
/// </summary>
public class WorkflowPrimaryDisplayBinding : IDisplayBinding
{
public WorkflowPrimaryDisplayBinding()
{
}
public bool CanCreateContentForFile(string fileName)
{
return Path.GetExtension(fileName).Equals(".xoml", StringComparison.OrdinalIgnoreCase) ;
}
public IViewContent CreateContentForFile(OpenedFile file)
{
return new WorkflowPrimaryViewContent(file);
}
}
}

84
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/PrimaryView/PrimaryViewContent.cs

@ -1,84 +0,0 @@ @@ -1,84 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
using WorkflowDesigner.Loaders;
namespace WorkflowDesigner
{
/// <summary>
/// Description of PrimaryViewContent.
/// </summary>
public class WorkflowPrimaryViewContent : AbstractViewContent, IHasPropertyContainer, IToolsHost
{
ViewContentControl control;
public WorkflowPrimaryViewContent(OpenedFile primaryFile) : base(primaryFile)
{
if (primaryFile == null)
throw new ArgumentNullException("primaryFile");
this.TabPageText = "Workflow";
control = new ViewContentControl(this);
primaryFile.ForceInitializeView(this); // call Load()
}
public override System.Windows.Forms.Control Control {
get {
return control;
}
}
public override void Load(OpenedFile file, Stream stream)
{
Debug.Assert(file == this.PrimaryFile);
control.LoadWorkflow(new XomlDesignerLoader(this, stream));
}
public override void Save(OpenedFile file, Stream stream)
{
Debug.Assert(file == this.PrimaryFile);
control.SaveWorkflow(stream);
}
public void LoadContent(string content)
{
if (content == null)
throw new ArgumentNullException("content");
XomlDesignerLoader xomlDesignerLoader = new XomlDesignerLoader(this);
xomlDesignerLoader.Xoml = content;
control.LoadWorkflow(xomlDesignerLoader);
}
#region IHasPropertyContainer
public PropertyContainer PropertyContainer {
get {
return control.PropertyContainer;
}
}
#endregion
System.Windows.Forms.Control IToolsHost.ToolsControl {
get {
return WorkflowSideTabService.WorkflowSideBar;
}
}
}
}

115
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/SecondaryView/SecondaryDisplayBinding.cs

@ -1,115 +0,0 @@ @@ -1,115 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
#region Using
using System;
using System.IO;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
#endregion
namespace WorkflowDesigner
{
/// <summary>
/// Description of SecondaryDisplayBinding.
/// </summary>
public class WorkflowDesignerSecondaryDisplayBinding : ISecondaryDisplayBinding
{
public WorkflowDesignerSecondaryDisplayBinding()
{
}
public bool ReattachWhenParserServiceIsReady {
get {
return true;
}
}
public bool CanAttachTo(IViewContent content)
{
if (content == null)
throw new ArgumentNullException("content");
if (content is ITextEditorControlProvider) {
ITextEditorControlProvider textAreaControlProvider = (ITextEditorControlProvider)content;
string fileName = content.PrimaryFileName;
if (fileName == null)
return false;
switch (Path.GetExtension(fileName).ToLowerInvariant()) {
case ".cs":
case ".vb":
ParseInformation info = ParserService.ParseFile(fileName, textAreaControlProvider.TextEditorControl.Document.TextContent, false);
if (IsDesignable(info))
return true;
break;
}
}
return false;
}
public IViewContent[] CreateSecondaryViewContent(IViewContent viewContent)
{
//HACK: Just create a view for now
return new IViewContent[] { new WorkflowDesignerSecondaryViewContent(viewContent)};
}
public static bool IsInitializeComponentsMethodName(string name)
{
return name == "InitializeComponents" || name == "InitializeComponent";
}
public static IMethod GetInitializeComponents(IClass c)
{
c = c.GetCompoundClass();
foreach (IMethod method in c.Methods) {
if (IsInitializeComponentsMethodName(method.Name) && method.Parameters.Count == 0) {
return method;
}
}
return null;
}
public static bool BaseClassIsWorkflow(IClass c)
{
// Simple test for fully qualified name
c = c.GetCompoundClass();
foreach (IReturnType baseType in c.BaseTypes) {
if (baseType.FullyQualifiedName == "System.Workflow.ComponentModel.Activity"
// also accept when could not be resolved
|| baseType.FullyQualifiedName == "Activity" )
{
return true;
}
}
IClass form = c.ProjectContent.GetClass("System.Workflow.ComponentModel.Activity", 0);
if (form != null && c.IsTypeInInheritanceTree(form))
return true;
return false;
}
public static bool IsDesignable(ParseInformation info)
{
if (info != null) {
ICompilationUnit cu = (ICompilationUnit)info.BestCompilationUnit;
foreach (IClass c in cu.Classes) {
IMethod method = GetInitializeComponents(c);
if (method != null) {
return BaseClassIsWorkflow(c);
}
}
}
return false;
}
}
}

67
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/SecondaryView/SecondaryViewContent.cs

@ -1,67 +0,0 @@ @@ -1,67 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
#region Using
using System;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop.Widgets.SideBar;
using WorkflowDesigner.Loaders;
#endregion
namespace WorkflowDesigner
{
/// <summary>
/// Description of SecondaryViewContent.
/// </summary>
public class WorkflowDesignerSecondaryViewContent : AbstractSecondaryViewContent, IHasPropertyContainer, IToolsHost
{
ViewContentControl control;
#region Constructors
public WorkflowDesignerSecondaryViewContent(IViewContent primaryViewContent) : base(primaryViewContent)
{
this.TabPageText = "Workflow";
control = new ViewContentControl(primaryViewContent);
}
#endregion
#region Property Accessors
public override Control Control {
get {
return control;
}
}
public PropertyContainer PropertyContainer {
get {
return control.PropertyContainer;
}
}
#endregion
protected override void LoadFromPrimary()
{
control.LoadWorkflow(new CodeDesignerLoader(this.PrimaryViewContent));
}
protected override void SaveToPrimary()
{
control.UnloadWorkflow();
}
System.Windows.Forms.Control IToolsHost.ToolsControl {
get {
return WorkflowSideTabService.WorkflowSideBar;
}
}
}
}

74
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/EventBindingService/CSharpWorkflowDesignerEventBindingService.cs

@ -1,74 +0,0 @@ @@ -1,74 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Drawing;
using System.Text;
using System.ComponentModel;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.TextEditor;
using ICSharpCode.TextEditor.Document;
using ICSharpCode.NRefactory.PrettyPrinter;
using ICSharpCode.NRefactory.Ast;
namespace WorkflowDesigner
{
/// <summary>
/// Description of CSharpWorkflowDesignerGenerator.
/// </summary>
public class CSharpWorkflowDesignerEventBindingService : WorkflowDesignerEventBindingService
{
public CSharpWorkflowDesignerEventBindingService(IServiceProvider provider, string codeSeparationFileName) : base(provider, codeSeparationFileName)
{
}
/// <summary>
/// Finds the start line for the cursor when positioning inside a method.
/// </summary>
/// <param name="document"></param>
/// <param name="method"></param>
/// <returns></returns>
protected override int GetCursorLine(IDocument document, IMethod method)
{
DomRegion r = method.BodyRegion;
int offset = document.PositionToOffset(new TextLocation(r.BeginColumn - 1, r.BeginLine - 1));
while (offset < document.TextLength) {
char c = document.GetCharAt(offset++);
if (c == '{') {
return r.BeginLine + 1;
}
if (c != ' ') {
break;
}
}
return r.BeginLine + 2;
}
protected override string CreateEventHandler(IClass completeClass, EventDescriptor edesc, string eventMethodName, string body, string indentation)
{
string param = GenerateParameters(completeClass, edesc, true);
StringBuilder b = new StringBuilder();
b.AppendLine(indentation);
b.AppendLine(indentation + "void " + eventMethodName + "(" + param + ")");
b.AppendLine(indentation + "{");
b.AppendLine(indentation + "\t" + body);
b.AppendLine(indentation + "}");
return b.ToString();
}
protected static string GenerateParameters(IClass completeClass, EventDescriptor eventDescriptor, bool paramNames)
{
CSharpOutputVisitor v = new CSharpOutputVisitor();
MethodDeclaration md = ConvertDescriptorToNRefactory(completeClass, eventDescriptor, "name");
if (md != null) {
v.AppendCommaSeparatedList(md.Parameters);
}
return v.Text;
}
}
}

201
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/EventBindingService/EventPropertyDescriptor.cs

@ -1,201 +0,0 @@ @@ -1,201 +0,0 @@
/*
* Created by SharpDevelop.
* User: Russell Wilkins
* Date: 30/01/2007
* Time: 12:17
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
#region Using
using System;
using System.ComponentModel.Design;
using System.ComponentModel;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Collections;
#endregion
namespace WorkflowDesigner
{
/// <summary>
/// Description of EventPropertyDescriptor.
/// </summary>
public class EventPropertyDescriptor : PropertyDescriptor
{
internal EventDescriptor eventDescriptor;
private IServiceProvider provider;
private TypeConverter converter;
public EventPropertyDescriptor(IServiceProvider provider, EventDescriptor eventDescriptor) : base(eventDescriptor, null)
{
this.eventDescriptor = eventDescriptor;
this.provider = provider;
}
public override Type ComponentType {
get {
return eventDescriptor.ComponentType;
}
}
public override bool IsReadOnly {
get {
return false;
}
}
public override TypeConverter Converter {
get {
if (converter == null)
converter = new EventPropertyTypeConverter(this);
return converter;
}
}
public override Type PropertyType {
get {
return eventDescriptor.EventType;
}
}
public override bool CanResetValue(object component)
{
return false;
}
public override object GetValue(object component)
{
Activity activity = component as Activity;
if (component == null)
throw new ArgumentException("component must be derived from Activity");
string value = null;
// Find method name associated with the EventDescriptor.
Hashtable events = activity.GetValue(WorkflowMarkupSerializer.EventsProperty) as Hashtable;
if (events != null) {
if (events.ContainsKey(this.eventDescriptor.Name))
value = events[this.eventDescriptor.Name] as string;
}
return value;
}
public override void ResetValue(object component)
{
SetValue(component, null);
}
public override void SetValue(object component, object value)
{
// Validate the parameters.
DependencyObject dependencyObject = component as DependencyObject;
if (dependencyObject == null)
throw new ArgumentException(component.ToString() + " must be derived from DependencyObject", "component");
// Get the event list form the dependency object.
Hashtable events = dependencyObject.GetValue(WorkflowMarkupSerializer.EventsProperty) as Hashtable;
if (events == null) {
events = new Hashtable();
dependencyObject.SetValue(WorkflowMarkupSerializer.EventsProperty, events);
}
string oldValue = events[this.eventDescriptor.Name] as string;
// Value not changed need go no further.
if (oldValue != null) {
if (oldValue.CompareTo(value) == 0)
return;
}
IComponentChangeService componentChangedService = provider.GetService(typeof(IComponentChangeService)) as IComponentChangeService;
componentChangedService.OnComponentChanging(component, this.eventDescriptor);
// Update to new value.
events[this.eventDescriptor.Name] = value;
componentChangedService.OnComponentChanged(component, this.eventDescriptor, oldValue, value);
}
public override bool ShouldSerializeValue(object component)
{
if (GetValue (component) == null) return false;
return true;
}
/// <summary>
/// To allow the designer to convert the descriptor to/from string.
/// </summary>
class EventPropertyTypeConverter : TypeConverter
{
private EventPropertyDescriptor eventPropertyDescriptor;
internal EventPropertyTypeConverter(EventPropertyDescriptor eventPropertyDescriptor)
{
this.eventPropertyDescriptor = eventPropertyDescriptor;
}
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
if (sourceType == typeof(string))
return true;
return base.CanConvertFrom(context, sourceType);
}
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
if (destinationType == typeof(string))
return true;
return base.CanConvertTo(context, destinationType);
}
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value is string)
return value;
return base.ConvertFrom(context, culture, value);
}
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
if (destinationType == typeof(string))
return value;
return base.ConvertTo(context, culture, value, destinationType);
}
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
ICollection compatibleMethods = null;;
if (context != null) {
IEventBindingService eventBindingService = context.GetService(typeof(IEventBindingService)) as IEventBindingService;
if (eventBindingService != null)
compatibleMethods = eventBindingService.GetCompatibleMethods(eventPropertyDescriptor.eventDescriptor);
}
return new StandardValuesCollection(compatibleMethods);
}
}
}
}

25
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/EventBindingService/IWorkflowDesignerEventBindingService.cs

@ -1,25 +0,0 @@ @@ -1,25 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
#region Using
using System;
using System.ComponentModel;
using System.Collections;
using System.ComponentModel.Design;
#endregion
namespace WorkflowDesigner
{
/// <summary>
/// Description of IWorkflowDesignerGenerator.
/// </summary>
public interface IWorkflowDesignerEventBindingService : IEventBindingService
{
string CodeFileName { get;}
void UpdateCodeCompileUnit();
}
}

425
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/EventBindingService/WorkflowDesignerEventBindingService.cs

@ -1,425 +0,0 @@ @@ -1,425 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
#region Using
using System;
using System.Text;
using System.IO;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Workflow.ComponentModel.Design;
using System.Reflection;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel.Compiler;
using System.CodeDom;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Dom.ReflectionLayer;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.TextEditor.Document;
using ICSharpCode.NRefactory.Visitors;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.Ast;
using ICSharpCode.SharpDevelop.Project;
using WorkflowDesigner.Loaders;
#endregion
namespace WorkflowDesigner
{
/// <summary>
/// Description of WorkflowDesignerGenerator.
/// </summary>
public abstract class WorkflowDesignerEventBindingService : IWorkflowDesignerEventBindingService, IServiceProvider
{
string codeFileName;
protected WorkflowDesignerEventBindingService(IServiceProvider provider, string codeFileName)
{
this.provider = provider;
this.codeFileName = codeFileName;
}
#region IWorkflowDesignerEventBindingService implementation
public void UpdateCodeCompileUnit()
{
LoggingService.Debug("UpdateCCU");
IProject project = ProjectService.OpenSolution.FindProjectContainingFile(codeFileName);
FileProjectItem fpi = project.FindFile(codeFileName);
TypeProviderService.UpdateCodeCompileUnit(fpi);
}
public string CodeFileName {
get {
return codeFileName;
}
}
private void RefreshCCU(object sender, EventArgs e)
{
}
#endregion
CodeCompileUnit Parse()
{
ParseInformation parseInfo = ParserService.GetParseInformation(codeFileName);
IClass formClass = null;
bool isFirstClassInFile;
IList<IClass> parts = FindFormClassParts(parseInfo, out formClass, out isFirstClassInFile);
// Get all the related compilation units.
List<KeyValuePair<string, CompilationUnit>> compilationUnits = new List<KeyValuePair<string, CompilationUnit>>();
foreach (IClass part in parts) {
string fileName = part.CompilationUnit.FileName;
if (fileName == null) continue;
bool found = false;
foreach (KeyValuePair<string, CompilationUnit> entry in compilationUnits) {
if (FileUtility.IsEqualFileName(fileName, entry.Key)) {
found = true;
break;
}
}
if (found) continue;
string fileContent = ParserService.GetParseableFileContent(fileName);
ICSharpCode.NRefactory.IParser parser = ICSharpCode.NRefactory.ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(fileContent));
parser.Parse();
if (parser.Errors.Count > 0) {
throw new WorkflowDesignerLoadException("Syntax errors in " + fileName + ":\r\n" + parser.Errors.ErrorOutput);
}
compilationUnits.Add(new KeyValuePair<string, CompilationUnit>(fileName, parser.CompilationUnit));
}
if (compilationUnits.Count == 1)
{
CodeDomVisitor visitor1 = new CodeDomVisitor();
visitor1.VisitCompilationUnit(compilationUnits[0].Value, null);
return visitor1.codeCompileUnit;
}
return null;
//string fileContent = ParserService.GetParseableFileContent(codeFileName);
// ICSharpCode.NRefactory.IParser parser = ICSharpCode.NRefactory.ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(fileContent));
// parser.Parse();
// if (parser.Errors.Count > 0) {
// throw new Exception("Syntax errors in " + codeFileName + ":\r\n" + parser.Errors.ErrorOutput);
// }
//
// CodeDomVisitor visitor = new CodeDomVisitor();
// visitor.VisitCompilationUnit(parser.CompilationUnit, null);
// return visitor.codeCompileUnit;
}
public static IList<IClass> FindFormClassParts(ParseInformation parseInfo, out IClass formClass, out bool isFirstClassInFile)
{
formClass = null;
isFirstClassInFile = true;
foreach (IClass c in parseInfo.BestCompilationUnit.Classes) {
if (WorkflowDesignerSecondaryDisplayBinding.BaseClassIsWorkflow(c)) {
formClass = c;
break;
}
isFirstClassInFile = false;
}
if (formClass == null)
throw new WorkflowDesignerLoadException("No class derived from Form or UserControl was found.");
// Initialize designer for formClass
formClass = formClass.GetCompoundClass();
if (formClass is CompoundClass) {
return (formClass as CompoundClass).Parts;
} else {
return new IClass[] { formClass };
}
}
#region IServiceProvider implementation
IServiceProvider provider;
public object GetService(Type serviceType)
{
return provider.GetService(serviceType);
}
#endregion
#region IEventBindingService implemention
public string CreateUniqueMethodName(IComponent component, EventDescriptor e)
{
if (component == null)
throw new ArgumentNullException("component");
if (e == null)
throw new ArgumentNullException("e");
LoggingService.Debug("CreateUniqueMethodName(" + component + ", " + e + ")");
return String.Format("{0}{1}", Char.ToUpper(component.Site.Name[0]) + component.Site.Name.Substring(1), e.DisplayName);
}
public EventDescriptor GetEvent(PropertyDescriptor property)
{
EventPropertyDescriptor epd = property as EventPropertyDescriptor;
if (epd == null)
return null;
return epd.eventDescriptor;
}
public PropertyDescriptorCollection GetEventProperties(EventDescriptorCollection events)
{
if (events == null)
throw new ArgumentNullException("events");
ArrayList props = new ArrayList();
foreach (EventDescriptor e in events)
props.Add (GetEventProperty (e));
return new PropertyDescriptorCollection ((PropertyDescriptor[]) props.ToArray (typeof (PropertyDescriptor)));
}
public PropertyDescriptor GetEventProperty(EventDescriptor e)
{
return new EventPropertyDescriptor(this,e);
}
public virtual ICollection GetCompatibleMethods(EventDescriptor edesc)
{
ArrayList compatibleMethods = new ArrayList();
IClass completeClass;
IDesignerHost designerHost = (IDesignerHost)this.GetService(typeof(IDesignerHost));
if (designerHost != null && designerHost.RootComponent != null)
{
IRootDesigner rootDesigner = designerHost.GetDesigner(designerHost.RootComponent) as IRootDesigner;
LoggingService.DebugFormatted("DesignerHost.RootComponent={0}", rootDesigner.Component.Site.Name);
ParseInformation info = ParserService.ParseFile(this.codeFileName);
ICompilationUnit cu = (ICompilationUnit)info.BestCompilationUnit;
MethodInfo methodInfo = edesc.EventType.GetMethod("Invoke");
foreach (IClass c in cu.Classes) {
if (c.Name == rootDesigner.Component.Site.Name){
LoggingService.DebugFormatted("Got designer class!");
completeClass = c.GetCompoundClass();
LoggingService.DebugFormatted("Looking for compatible methods");
foreach (IMethod method in completeClass.Methods) {
if (method.Parameters.Count == methodInfo.GetParameters().Length) {
bool found = true;
for (int i = 0; i < methodInfo.GetParameters().Length; ++i) {
ParameterInfo pInfo = methodInfo.GetParameters()[i];
IParameter p = method.Parameters[i];
if (p.ReturnType.FullyQualifiedName != pInfo.ParameterType.ToString()) {
found = false;
break;
}
}
if (found) {
compatibleMethods.Add(method.Name);
}
}
}
}
}
}
return compatibleMethods;
}
public bool ShowCode()
{
FileService.OpenFile(codeFileName);
return true;
}
public bool ShowCode(int lineNumber)
{
ITextEditorControlProvider t = FileService.OpenFile(codeFileName) as ITextEditorControlProvider;
t.TextEditorControl.ActiveTextAreaControl.JumpTo(lineNumber);
return true;
}
public bool ShowCode(IComponent component, EventDescriptor e)
{
if (component == null)
throw new ArgumentNullException("component");
if (e == null)
throw new ArgumentNullException("e");
Activity activity = component as Activity;
if (component == null)
throw new ArgumentException("component must be derived from Activity");
string methodName = string.Empty;
// Find method name associated with the EventDescriptor.
Hashtable events = activity.GetValue(WorkflowMarkupSerializer.EventsProperty) as Hashtable;
if (events != null) {
if (events.ContainsKey(e.Name))
methodName = events[e.Name] as string;
}
return UseMethod(component, e, methodName);
}
#endregion
protected virtual int GetCursorLine(IDocument document, IMethod method)
{
return method.BodyRegion.BeginLine + 1;
}
protected abstract string CreateEventHandler(IClass completeClass, EventDescriptor eventDescriptor, string eventMethodName, string body, string indentation);
public bool ShowCode(IComponent component, EventDescriptor e, string methodName)
{
LoggingService.DebugFormatted("ShowCode {0}", methodName);
IDesignerHost designerHost = (IDesignerHost)this.GetService(typeof(IDesignerHost));
IRootDesigner rootDesigner = designerHost.GetDesigner(designerHost.RootComponent) as IRootDesigner;
ParseInformation info = ParserService.ParseFile(this.codeFileName);
ICompilationUnit cu = (ICompilationUnit)info.BestCompilationUnit;
ITextEditorControlProvider t = FileService.OpenFile(codeFileName) as ITextEditorControlProvider;
IClass completeClass;
foreach (IClass c in cu.Classes) {
if (c.Name == rootDesigner.Component.Site.Name){
completeClass = c.GetCompoundClass();
foreach (IMethod method in completeClass.Methods) {
if (method.Name == methodName)
{
int position = GetCursorLine(t.TextEditorControl.Document, method);
t.TextEditorControl.ActiveTextAreaControl.JumpTo(position-1);
return true;
}
}
}
}
return false;
}
/// <summary>
/// Gets a method implementing the signature specified by the event descriptor
/// </summary>
protected static IMethod ConvertDescriptorToDom(IClass completeClass, EventDescriptor edesc, string methodName)
{
MethodInfo mInfo = edesc.EventType.GetMethod("Invoke");
DefaultMethod m = new DefaultMethod(completeClass, methodName);
m.ReturnType = ReflectionReturnType.Create(m, mInfo.ReturnType, false);
foreach (ParameterInfo pInfo in mInfo.GetParameters()) {
m.Parameters.Add(new ReflectionParameter(pInfo, m));
}
return m;
}
/// <summary>
/// Gets a method implementing the signature specified by the event descriptor
/// </summary>
protected static ICSharpCode.NRefactory.Ast.MethodDeclaration
ConvertDescriptorToNRefactory(IClass completeClass, EventDescriptor eventDescriptor, string methodName)
{
return ICSharpCode.SharpDevelop.Dom.Refactoring.CodeGenerator.ConvertMember(
ConvertDescriptorToDom(completeClass, eventDescriptor, methodName),
new ClassFinder(completeClass, completeClass.BodyRegion.BeginLine + 1, 1)
) as ICSharpCode.NRefactory.Ast.MethodDeclaration;
}
protected virtual int GetEventHandlerInsertionLine(IClass c)
{
return c.Region.EndLine;
}
public bool UseMethod(IComponent component, EventDescriptor eventDescriptor, string methodName)
{
LoggingService.DebugFormatted("UseMethod {0}", methodName);
LoggingService.DebugFormatted("CodeFileName={0}", this.codeFileName);
IClass completeClass;
IDesignerHost designerHost = (IDesignerHost)this.GetService(typeof(IDesignerHost));
if (designerHost != null && designerHost.RootComponent != null) {
IRootDesigner rootDesigner = designerHost.GetDesigner(designerHost.RootComponent) as IRootDesigner;
ITextEditorControlProvider t = FileService.OpenFile(codeFileName) as ITextEditorControlProvider;
LoggingService.DebugFormatted("DesignerHost.RootComponent={0}", rootDesigner.Component.Site.Name);
ParseInformation info = ParserService.ParseFile(this.codeFileName);
ICompilationUnit cu = (ICompilationUnit)info.BestCompilationUnit;
MethodInfo methodInfo = eventDescriptor.EventType.GetMethod("Invoke");
completeClass = cu.Classes[0].GetCompoundClass();
LoggingService.DebugFormatted("Looking for matching methods...");
foreach (IMethod method in completeClass.Methods) {
if ((method.Name == methodName) &&
(method.Parameters.Count == methodInfo.GetParameters().Length)) {
bool found = true;
LoggingService.DebugFormatted("Name & nbr parms match, checking types...");
for (int i = 0; i < methodInfo.GetParameters().Length; ++i) {
ParameterInfo pInfo = methodInfo.GetParameters()[i];
IParameter p = method.Parameters[i];
if (p.ReturnType.FullyQualifiedName != pInfo.ParameterType.ToString()) {
found = false;
break;
}
}
if (found) {
LoggingService.DebugFormatted("Found matching method {0}", method.Name);
int position = GetCursorLine(t.TextEditorControl.Document, method);
t.TextEditorControl.ActiveTextAreaControl.JumpTo(position-1);
return true;
}
}
}
LoggingService.DebugFormatted("Creating new method...");
int line = GetEventHandlerInsertionLine(cu.Classes[0]);
int offset = t.TextEditorControl.Document.GetLineSegment(line - 1).Offset;
t.TextEditorControl.Document.Insert(offset, CreateEventHandler(completeClass, eventDescriptor, methodName, "", "\t\t"));
UpdateCodeCompileUnit();
return ShowCode(component, eventDescriptor, methodName);
}
return false;
}
}
}

73
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/ExtendedUIService.cs

@ -1,73 +0,0 @@ @@ -1,73 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Workflow.ComponentModel.Design;
namespace WorkflowDesigner
{
/// <summary>
/// Description of ExtendedUIService.
/// </summary>
public class ExtendedUIService : IExtendedUIService
{
public ExtendedUIService()
{
}
public System.Windows.Forms.DialogResult AddWebReference(out Uri url, out Type proxyClass)
{
throw new NotImplementedException();
}
public Uri GetUrlForProxyClass(Type proxyClass)
{
throw new NotImplementedException();
}
public Type GetProxyClassForUrl(Uri url)
{
throw new NotImplementedException();
}
public void AddDesignerActions(DesignerAction[] actions)
{
//throw new NotImplementedException();
}
public void RemoveDesignerActions()
{
//throw new NotImplementedException();
}
public bool NavigateToProperty(string propName)
{
throw new NotImplementedException();
}
public System.ComponentModel.ITypeDescriptorContext GetSelectedPropertyContext()
{
throw new NotImplementedException();
}
public void ShowToolsOptions()
{
throw new NotImplementedException();
}
public System.Collections.Generic.Dictionary<string, Type> GetXsdProjectItemsInfo()
{
throw new NotImplementedException();
}
public void AddAssemblyReference(System.Reflection.AssemblyName assemblyName)
{
throw new NotImplementedException();
}
}
}

96
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/MemberCreationService.cs

@ -1,96 +0,0 @@ @@ -1,96 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
#region Using
using System;
using System.CodeDom;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Compiler;
using ICSharpCode.Core;
#endregion
namespace WorkflowDesigner
{
/// <summary>
/// Description of MemberCreationService.
/// </summary>
public class MemberCreationService : IMemberCreationService, IServiceProvider
{
private string typeName = string.Empty;
#region IServiceProvider implementation
IServiceProvider provider;
public object GetService(Type serviceType)
{
return provider.GetService(serviceType);
}
#endregion
public MemberCreationService(IServiceProvider provider)
{
this.provider = provider;
}
public void CreateField(string className, string fieldName, Type fieldType, Type[] genericParameterTypes, MemberAttributes attributes, System.CodeDom.CodeSnippetExpression initializationExpression, bool overwriteExisting)
{
throw new NotImplementedException();
}
public void CreateProperty(string className, string propertyName, Type propertyType, AttributeInfo[] attributes, bool emitDependencyProperty, bool isMetaProperty, bool isAttached, Type ownerType, bool isReadOnly)
{
throw new NotImplementedException();
}
public void CreateEvent(string className, string eventName, Type eventType, AttributeInfo[] attributes, bool emitDependencyProperty)
{
throw new NotImplementedException();
}
public void UpdateTypeName(string oldClassName, string newClassName)
{
LoggingService.DebugFormatted("UpdateTypeName(oldClassName={0}, newClassName={1})", oldClassName, newClassName);
typeName = newClassName;
}
public void UpdateBaseType(string className, Type baseType)
{
throw new NotImplementedException();
}
public void UpdateProperty(string className, string oldPropertyName, Type oldPropertyType, string newPropertyName, Type newPropertyType, System.Workflow.ComponentModel.Compiler.AttributeInfo[] attributes, bool emitDependencyProperty, bool isMetaProperty)
{
throw new NotImplementedException();
}
public void UpdateEvent(string className, string oldEventName, Type oldEventType, string newEventName, Type newEventType, System.Workflow.ComponentModel.Compiler.AttributeInfo[] attributes, bool emitDependencyProperty, bool isMetaProperty)
{
throw new NotImplementedException();
}
public void RemoveProperty(string className, string propertyName, Type propertyType)
{
throw new NotImplementedException();
}
public void RemoveEvent(string className, string eventName, Type eventType)
{
throw new NotImplementedException();
}
public void ShowCode(Activity activity, string methodName, Type delegateType)
{
throw new NotImplementedException();
}
public void ShowCode()
{
throw new NotImplementedException();
}
}
}

75
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/PropertyValueUIService.cs

@ -1,75 +0,0 @@ @@ -1,75 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
#region Using
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing.Design;
#endregion
namespace WorkflowDesigner
{
/// <summary>
/// Description of PropertyValueUIService.
/// </summary>
public class PropertyValueUIService : IPropertyValueUIService
{
private PropertyValueUIHandler handler;
public PropertyValueUIService()
{
}
public event EventHandler PropertyUIValueItemsChanged;
public void AddPropertyValueUIHandler(PropertyValueUIHandler newHandler)
{
if (newHandler == null)
throw new ArgumentNullException("newHandler");
handler += newHandler;
}
public PropertyValueUIItem[] GetPropertyUIValueItems(ITypeDescriptorContext context, PropertyDescriptor propDesc)
{
if (context == null)
throw new ArgumentNullException("context");
if (propDesc == null)
throw new ArgumentNullException("propDesc");
if (handler != null){
ArrayList valueUIItemList = new ArrayList();
handler(context, propDesc, valueUIItemList);
if (valueUIItemList.Count > 0) {
PropertyValueUIItem[] valueItems = new PropertyValueUIItem[valueUIItemList.Count];
valueUIItemList.CopyTo(valueItems, 0);
return valueItems;
}
}
return null;
}
public void NotifyPropertyValueUIItemsChanged()
{
if (PropertyUIValueItemsChanged != null)
PropertyUIValueItemsChanged(this, EventArgs.Empty);
}
public void RemovePropertyValueUIHandler(PropertyValueUIHandler newHandler)
{
if (newHandler == null)
throw new ArgumentNullException("newHandler");
handler -= newHandler;
}
}
}

349
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/TypeProviderService.cs

@ -1,349 +0,0 @@ @@ -1,349 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
#region Using
using System;
using System.Collections.Specialized;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Workflow.ComponentModel.Compiler;
using System.Reflection;
using System.CodeDom;
using System.CodeDom.Compiler;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop;
using ICSharpCode.Core;
using ICSharpCode.NRefactory.Visitors;
using ICSharpCode.NRefactory.Ast;
using ICSharpCode.NRefactory;
#endregion
namespace WorkflowDesigner
{
/// <summary>
/// This service maintains a single TypeProvider for each workflow project. All designers in
/// the project will use the same typeprovider. The providers are kept up to date with the
/// project references so the designers do no need manage it themselves.
/// </summary>
public class TypeProviderService
{
private static Dictionary<IProject, TypeProvider> providers;
private static Dictionary<FileProjectItem, CodeCompileUnit> codeCompileUnits;
#region Property Accessors
private static Dictionary<IProject, TypeProvider> Providers {
get {
if (providers == null)
providers = new Dictionary<IProject, TypeProvider>();
return providers;
}
}
private static Dictionary<FileProjectItem, CodeCompileUnit> CodeCompileUnits {
get {
if (codeCompileUnits == null)
codeCompileUnits = new Dictionary<FileProjectItem, CodeCompileUnit>();
return codeCompileUnits;
}
}
#endregion
static TypeProviderService()
{
ProjectService.ProjectItemRemoved += ProjectItemRemovedEventHandler;
ProjectService.ProjectItemAdded += ProjectItemAddedEventHandler;
ProjectService.SolutionClosing += SolutionClosingEventHandler;
}
/// <summary>
/// Return the type provider for the specified project.
/// </summary>
/// <param name="project">Project whose ITypeProvider is required</param>
/// <returns>The ITypeProvider for the pass IProject, or a default provider if
/// no project passed.</returns>
public static ITypeProvider GetTypeProvider(IProject project)
{
if ((project != null) && (Providers.ContainsKey(project)))
return Providers[project];
TypeProvider typeProvider = new TypeProvider(null);
// Add the essential designer assemblies.
typeProvider.AddAssembly(typeof(System.Object).Assembly);
typeProvider.AddAssembly(typeof(System.ComponentModel.Design.Serialization.CodeDomSerializer).Assembly);
typeProvider.AddAssembly(typeof(System.Workflow.ComponentModel.DependencyObject).Assembly);
typeProvider.AddAssembly(typeof(System.Workflow.Activities.SequentialWorkflowActivity).Assembly);
typeProvider.AddAssembly(typeof(System.Workflow.Runtime.WorkflowRuntime).Assembly);
// Just return the basic provider if not related to a project.
if (project == null)
return typeProvider;
LoadProjectReferences(project, typeProvider);
RefreshCodeCompileUnits(project, typeProvider);
Providers.Add(project, typeProvider);
MSBuildBasedProject p = project as MSBuildBasedProject;
p.ActiveConfigurationChanged += ActiveConfigurationChangedEventHandler;
return typeProvider;
}
private static void LoadProjectReferences(IProject project, TypeProvider typeProvider)
{
foreach (ProjectItem item in project.Items) {
Assembly assembly = LoadAssembly(item, AppDomain.CurrentDomain);
if (assembly != null) {
if (!typeProvider.ReferencedAssemblies.Contains(assembly))
typeProvider.AddAssembly(assembly);
}
}
}
private static void ProjectItemAddedEventHandler(object sender, ProjectItemEventArgs e)
{
if (e.Project == null) return;
if (!Providers.ContainsKey(e.Project)) return;
ReferenceProjectItem item = e.ProjectItem as ReferenceProjectItem;
if (item == null) return;
Assembly assembly = LoadAssembly(item);
if (assembly != null)
Providers[e.Project].AddAssembly(assembly);
}
private static void ProjectItemRemovedEventHandler(object sender, ProjectItemEventArgs e)
{
if (e.Project == null) return;
if (!Providers.ContainsKey(e.Project)) return;
ReferenceProjectItem item = e.ProjectItem as ReferenceProjectItem;
if (item == null) return;
Assembly assembly = LoadAssembly(item);
if (assembly != null)
Providers[e.Project].RemoveAssembly(assembly);
}
private static Assembly LoadAssembly(ProjectItem item)
{
return LoadAssembly(item, AppDomain.CurrentDomain);
}
private static Assembly LoadAssembly(ProjectItem item, AppDomain appDomain)
{
Assembly assembly = null;
if (item is ProjectReferenceProjectItem) {
ProjectReferenceProjectItem pitem = item as ProjectReferenceProjectItem;
// TODO: This is only a temporary solution so the assembly is not locked.
// Need to look at this in terms of using a separate domain.
if (File.Exists(pitem.ReferencedProject.OutputAssemblyFullPath))
assembly = appDomain.Load(File.ReadAllBytes(pitem.ReferencedProject.OutputAssemblyFullPath));
} else if (item is ReferenceProjectItem) {
assembly = ReflectionLoader.ReflectionLoadGacAssembly(item.Include, false);
if (assembly == null) {
AssemblyName name = new AssemblyName();
name.CodeBase = item.FileName;
assembly = appDomain.Load(name);
}
}
return assembly;
}
private static void SolutionClosingEventHandler(object sender, SolutionEventArgs e)
{
// Remove unsed providers for closed projects.
foreach (IProject project in e.Solution.Projects) {
if (Providers.ContainsKey(project)) {
Providers[project].Dispose();
Providers.Remove(project);
}
}
}
private static void ActiveConfigurationChangedEventHandler(object sender, EventArgs e)
{
IProject project = sender as IProject;
if (!Providers.ContainsKey(project))
return;
// Reload the typeprovider.
ICSharpCode.Core.LoggingService.DebugFormatted("Reloading TypeProvider assemblies for project {0}", project.Name);
TypeProvider typeProvider = Providers[project];
foreach (Assembly asm in typeProvider.ReferencedAssemblies)
typeProvider.RemoveAssembly(asm);
LoadProjectReferences(project, typeProvider);
}
private static void RefreshCodeCompileUnits(IProject project, TypeProvider typeProvider)
{
ICSharpCode.Core.LoggingService.Debug("RefreshCodeCompileUnits");
// First use the workflow compiler to create one ccu for all the workflows
StringCollection files = new StringCollection();
foreach (ProjectItem item in project.GetItemsOfType(ItemType.Content)){
files.AddRange(GetRelatedFiles(project, item.FileName));
}
CodeCompileUnit ccu;
if (files.Count > 0) {
string[] s = new string[files.Count];
for (int i = 0; i < files.Count; i++)
s[i] = files[i];
ccu = ParseXoml(project, s);
if (ccu != null) {
typeProvider.AddCodeCompileUnit(ccu);
cp.UserCodeCompileUnits.Add(ccu);
}
}
// Now create one ccu for each source file.
foreach (ProjectItem item in project.GetItemsOfType(ItemType.Compile)){
ICSharpCode.Core.LoggingService.Debug(item.FileName);
if (item is FileProjectItem){
if (!Path.GetFileName(item.FileName).StartsWith("AssemblyInfo")){
ccu = Parse(item.FileName);
if (ccu != null) {
typeProvider.AddCodeCompileUnit(ccu);
cp.UserCodeCompileUnits.Add(ccu);
CodeCompileUnits.Add(item as FileProjectItem, ccu);
}
}
}
}
}
public static void UpdateCodeCompileUnit(FileProjectItem item)
{
TypeProvider typeProvider = Providers[item.Project];
if (typeProvider == null)
return;
// Remove the old ccu
if (CodeCompileUnits.ContainsKey(item))
typeProvider.RemoveCodeCompileUnit(CodeCompileUnits[item]);
// Build the new unit.
CodeCompileUnit codeCompileUnit = Parse(item.FileName);
// Now add the new unit.
if ( codeCompileUnit != null) {
typeProvider.AddCodeCompileUnit(codeCompileUnit);
if (CodeCompileUnits.ContainsKey(item))
CodeCompileUnits[item] = codeCompileUnit;
else
CodeCompileUnits.Add(item, codeCompileUnit);
}
}
static WorkflowCompilerParameters cp = new WorkflowCompilerParameters();
private static string[] GetRelatedFiles(IProject project, string fileName)
{
StringCollection files = new StringCollection();
files.Add(fileName);
foreach (ProjectItem item in project.Items){
if (item is FileProjectItem) {
FileProjectItem fItem = item as FileProjectItem;
if ((item.ItemType == ItemType.Compile) || (item.ItemType == ItemType.Content)) {
if (fItem.DependentUpon == Path.GetFileName(fileName)){
files.Add(item.FileName);
}
}
}
}
string[] s = new string[files.Count];
for (int i = 0; i < files.Count; i++)
s[i] = files[i];
return s;
}
private static CodeCompileUnit ParseXoml(IProject project, string[] fileNames)
{
ICSharpCode.Core.LoggingService.DebugFormatted("ParseXoml {0}", fileNames);
cp.GenerateCodeCompileUnitOnly = true;
cp.LanguageToUse = "CSharp";
WorkflowCompiler compiler = new WorkflowCompiler();
WorkflowCompilerResults results = compiler.Compile(cp, fileNames);
if (results.Errors.Count > 0) {
foreach (CompilerError e in results.Errors) {
ICSharpCode.Core.LoggingService.ErrorFormatted("{0}: {1}: {2}", e.Line, e.ErrorNumber, e.ErrorText);
}
return null;
}
return results.CompiledUnit;
}
private static CodeCompileUnit Parse(string fileName)
{
ICSharpCode.Core.LoggingService.DebugFormatted("Parse {0}", fileName);
string fileContent = ParserService.GetParseableFileContent(fileName);
ICSharpCode.NRefactory.IParser parser = ICSharpCode.NRefactory.ParserFactory.CreateParser(SupportedLanguage.CSharp, new StringReader(fileContent));
parser.Parse();
if (parser.Errors.Count > 0) {
return null;
}
CodeDomVisitor visitor = new CodeDomVisitor();
try {
visitor.VisitCompilationUnit(parser.CompilationUnit, null);
return visitor.codeCompileUnit;
} catch (Exception e) {
ICSharpCode.Core.LoggingService.Error("Parse", e);
return null;
}
}
}
}

137
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/TypeResolutionService.cs

@ -1,137 +0,0 @@ @@ -1,137 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
#region Using
using System;
using System.IO;
using System.Reflection;
using System.ComponentModel.Design;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Dom;
using System.Workflow.ComponentModel.Compiler;
#endregion
namespace WorkflowDesigner
{
/// <summary>
/// Description of TypeResolutionService.
/// </summary>
public class TypeResolutionService : ITypeResolutionService, IServiceProvider
{
IProject project;
#region Constructors
public TypeResolutionService(IProject project, IServiceProvider provider)
{
this.project = project;
this.provider = provider;
}
#endregion
#region IServiceProvider implementation
IServiceProvider provider;
public object GetService(Type serviceType)
{
return provider.GetService(serviceType);
}
#endregion
#region ITypeResolutionService implementation
public Assembly GetAssembly(AssemblyName name)
{
return GetAssembly(name, true);
}
public Assembly GetAssembly(AssemblyName name, bool throwOnError)
{
throw new NotImplementedException();
}
public Type GetType(string name)
{
return GetType(name, false);
}
public Type GetType(string name, bool throwOnError)
{
return GetType(name, throwOnError, false);
}
public Type GetType(string name, bool throwOnError, bool ignoreCase)
{
Type type = null;
// Ignoring versions numbers on types.
string[] splitName = name.Split(',');
string typeName = splitName[0].Replace('+','.');
// Check for the type ourselves in the projects referenced assemblies
// as the System.Workflow.ComponentModel.Compiler.TypeProvider does
// not seem find private types in referenced assemblies!
TypeProvider typeProvider = provider.GetService(typeof(ITypeProvider)) as TypeProvider;
if (typeProvider != null) {
foreach (Assembly asm in typeProvider.ReferencedAssemblies){
foreach (Module module in asm.GetModules()){
type = module.GetType(typeName, throwOnError, ignoreCase);
if (type != null)
return type;
}
}
}
if (type == null)
type = typeProvider.GetType(typeName, throwOnError);
// TODO: Need to check current project see if we can find it!
if (type == null) {
LoggingService.WarnFormatted("TypeResolutionService failed to find type {0}", typeName);
if (throwOnError)
throw new TypeLoadException(name + " not found by TypeResolutionService");
}
return type;
}
public void ReferenceAssembly(AssemblyName name)
{
// Check if assembly already exist in project, add it if not.
TypeProvider typeProvider = provider.GetService(typeof(ITypeProvider)) as TypeProvider;
if (typeProvider == null)
return;
foreach (Assembly asm in typeProvider.ReferencedAssemblies){
if (asm.FullName == name.FullName)
return;
}
LoggingService.DebugFormatted("TypeResolutionService.ReferenceAssembly {0}", name);
// TODO: Not in project so add the reference.
// IProject project = ProjectService.CurrentProject;
// if (project != null) {
// ReferenceProjectItem rpi = new ReferenceProjectItem(project, name.Name);
// rpi.Include = name.Name;
// ProjectService.AddProjectItem(project, rpi);
// project.Save();
// }
throw new NotImplementedException();
}
public string GetPathOfAssembly(AssemblyName name)
{
throw new NotImplementedException();
}
#endregion
}
}

139
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/WorkflowMenuCommandService.cs

@ -1,139 +0,0 @@ @@ -1,139 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
#region Using
using System;
using System.ComponentModel.Design;
using System.Workflow.ComponentModel.Design;
using System.Windows.Forms;
using System.Drawing;
using System.Collections;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
#endregion
namespace WorkflowDesigner
{
/// <summary>
/// Description of MenuCommandService.
/// </summary>
public class WorkflowMenuCommandService : System.ComponentModel.Design.MenuCommandService
{
private const string DESIGNER_ACTION_GUID = "3bd4a275-fccd-49f0-b617-765ce63b4340";
public WorkflowMenuCommandService(IServiceProvider host) : base(host)
{
}
public override void ShowContextMenu(CommandID menuID, int x, int y)
{
if (menuID == null)
throw new ArgumentNullException("menuID");
LoggingService.Debug("ShowContextMenu");
ContextMenuStrip contextMenu = null;
if (menuID == WorkflowMenuCommands.DesignerActionsMenu) {
Guid designerActionGuid = new Guid(DESIGNER_ACTION_GUID);
ICollection collection = this.GetCommandList(menuID.Guid);
foreach (System.ComponentModel.Design.MenuCommand menuCommand in collection) {
// Only interested in the errors.
if (menuCommand.CommandID.ID == 8342) {
if (contextMenu == null)
contextMenu = new ContextMenuStrip();
ToolStripMenuItem menuItem = new ToolStripMenuItem(menuCommand.Properties["Text"].ToString());
menuItem.Click += new EventHandler(DesignerActionsMenuClickHandler);
menuItem.Tag = menuCommand.Properties[designerActionGuid];
contextMenu.Items.Add(menuItem);
}
}
} else if (menuID == WorkflowMenuCommands.SelectionMenu) {
foreach (DesignerVerb verb in Verbs) {
if (verb.Visible) {
if (contextMenu == null)
contextMenu = new ContextMenuStrip();
ToolStripMenuItem menuItem = new ToolStripMenuItem(verb.Text);
menuItem.Click += new EventHandler(SelectionMenuClickHandler);
menuItem.Enabled = verb.Enabled;
menuItem.Checked = verb.Checked;
menuItem.Tag = verb;
contextMenu.Items.Add(menuItem);
}
}
}
if (contextMenu != null) {
//WorkflowView workflowView = GetService(typeof(WorkflowView)) as WorkflowView;
//contextMenu.Show(workflowView , workflowView.PointToClient(new Point(x, y)));
contextMenu.Show(x, y);
//contextMenu.Capture = true;
}
}
private void SelectionMenuClickHandler(object sender, EventArgs e)
{
ToolStripMenuItem menuItem = sender as ToolStripMenuItem;
if (menuItem != null){
System.ComponentModel.Design.MenuCommand command = menuItem.Tag as System.ComponentModel.Design.MenuCommand;
if (command != null)
command.Invoke();
}
}
void DesignerActionsMenuClickHandler(object sender, EventArgs e)
{
DesignerAction designerAction = ((ToolStripMenuItem)sender).Tag as DesignerAction;
if (designerAction == null)
return;
designerAction.Invoke(); // Will change the selectedObject in the designer
if (!string.IsNullOrEmpty( designerAction.PropertyName)) {
// No easy way I can find to search for a specific griditem so
// find the root item in the grid, and search for items for the property.
GridItem item = PropertyPad.Grid.SelectedGridItem;
while (item.Parent != null) {
item = item.Parent;
}
GridItem item2 = FindGridItem(item, designerAction.PropertyName);
if (item2 != null) {
PropertyPad.Grid.SelectedGridItem = item2;
PropertyPad.Grid.Focus();
}
}
}
static GridItem FindGridItem(GridItem gridItem, string name)
{
foreach (GridItem item in gridItem.GridItems){
if (item.Label == name)
return item;
GridItem item2 = FindGridItem(item, name);
if (item2 != null)
return item2;
}
return null;
}
}
}

388
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/WorkflowSideTabService.cs

@ -1,388 +0,0 @@ @@ -1,388 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
#region Using
using System;
using System.IO;
using System.Drawing;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing.Design;
using System.ComponentModel.Design;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Widgets.SideBar;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Dom;
#endregion
namespace WorkflowDesigner
{
/// <summary>
/// This class manages the display of the SideTabs in the tools pad.
/// There a three types of SideTab:
/// Standard - contains the standard workflow components from System.Workflow.Activities.
/// Project - contains the activities in the current project.
/// References - One sidetab for each project assembly reference that contains activities.
/// </summary>
public sealed class WorkflowSideTabService
{
private static IViewContent activeViewContent;
private static IProject activeProject;
private static SideTab standardSideTab;
private static int viewCount;
private static Dictionary<IProject, Dictionary<ReferenceProjectItem, SideTab>> projects;
private static bool initialised;
#region Properties
private static IProject ActiveProject {
get { return activeProject; }
set {
if (activeProject == value)
return;
if (value == null)
RemoveAllSideTabs();
else {
if (activeProject != null)
RemoveProjectSideTabs(activeProject);
ShowSideTabsForProject(value);
}
activeProject = value;
}
}
private static Dictionary<IProject, Dictionary<ReferenceProjectItem, SideTab>> Projects {
get {
if (projects == null)
projects = new Dictionary<IProject, Dictionary<ReferenceProjectItem, SideTab>> ();
return projects;
}
}
private static int ViewCount {
get { return viewCount; }
set {
viewCount = value;
if (viewCount == 0) {
standardSideTab = null;
ActiveProject = null;
}
}
}
static SharpDevelopSideBar workflowSideBar;
public static SharpDevelopSideBar WorkflowSideBar {
get {
Debug.Assert(WorkbenchSingleton.InvokeRequired == false);
if (workflowSideBar == null) {
workflowSideBar = new SharpDevelopSideBar();
workflowSideBar.Tabs.Add(standardSideTab);
WorkflowSideBar.ActiveTab = standardSideTab;
}
return workflowSideBar;
}
}
#endregion
private static void Initialise()
{
// Make sure the side bar has actually been created!
ProjectService.ProjectItemRemoved += ProjectItemRemovedEventHandler;
ProjectService.ProjectItemAdded += ProjectItemAddedEventHandler;
ProjectService.SolutionClosing += SolutionClosingEventHandler;
initialised = true;
}
public static void AddViewContent(IViewContent viewContent)
{
if (viewContent == null)
throw new ArgumentNullException("viewContent");
if (!initialised)
Initialise();
// Make sure the standard workflow sidebar exists
if (standardSideTab == null) {
LoggingService.Debug("Creating standard workflow sidetab");
standardSideTab = CreateSideTabFromAssembly("Workflow", new AssemblyName("System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"));
LoadSideTabItemsFromAssembly(new AssemblyName("System.Workflow.ComponentModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"), standardSideTab);
}
// Attach the handlers.
//viewContent.Disposed += ViewContentDisposedEventHandler;
ViewCount++;
}
#region ProjectService event handlers
private static void ProjectItemAddedEventHandler(object sender, ProjectItemEventArgs e)
{
if (e.Project == null) return;
if (!Projects.ContainsKey(e.Project)) return;
ReferenceProjectItem item = e.ProjectItem as ReferenceProjectItem;
if (item == null) return;
Dictionary<ReferenceProjectItem, SideTab> references = Projects[e.Project];
if (item is ProjectReferenceProjectItem) {
references.Add(item, CreateSideTabForProjectItem(item));
return;
} else if (item is ReferenceProjectItem) {
if (!e.ProjectItem.Include.StartsWith("System")){
references.Add(item, CreateSideTabForProjectItem(item));
}
} else {
return;
}
if (ActiveProject == e.Project)
{
if (!WorkflowSideBar.Tabs.Contains(references[item])) {
WorkflowSideBar.Tabs.Add(references[item]);
}
}
}
private static void ProjectItemRemovedEventHandler(object sender, ProjectItemEventArgs e)
{
if (e.Project == null) return;
if (!Projects.ContainsKey(e.Project)) return;
ReferenceProjectItem item = e.ProjectItem as ReferenceProjectItem;
if (item == null) return;
Dictionary<ReferenceProjectItem, SideTab> references = Projects[e.Project];
if (references.ContainsKey(item)){
if (WorkflowSideBar.Tabs.Contains(references[item])) {
WorkflowSideBar.Tabs.Remove(references[item]);
}
references.Remove(item);
}
}
private static void SolutionClosingEventHandler(object sender, SolutionEventArgs e)
{
foreach (IProject project in e.Solution.Projects) {
if (Projects.ContainsKey(project)) {
RemoveProjectSideTabs(project);
Projects.Remove(project);
}
}
}
#endregion
#region IViewContent event handlers
private static void ViewContentDisposedEventHandler(object sender, EventArgs args)
{
LoggingService.DebugFormatted("ViewContentDisposedEventHandler {0}", sender);
ViewCount--;
}
private static void ViewContentActivatedEventHandler(object sender, EventArgs args)
{
LoggingService.DebugFormatted("ViewActivated {0}", sender);
if (activeViewContent == sender)
return;
// Make sure the standard workflow sidebar is on screen.
if (!WorkflowSideBar.Tabs.Contains(standardSideTab)) {
WorkflowSideBar.Tabs.Add(standardSideTab);
if (WorkflowSideBar.Tabs.Count == 1) {
WorkflowSideBar.ActiveTab = WorkflowSideBar.Tabs[0];
}
}
LoggingService.DebugFormatted("ViewActivated {0}", sender);
activeViewContent = sender as IViewContent;
ActiveProject = ProjectService.OpenSolution.FindProjectContainingFile(activeViewContent.PrimaryFileName);
WorkflowSideBar.Refresh();
}
#endregion;
private static void ShowSideTabsForProject(IProject project)
{
if (!Projects.ContainsKey(project)){
Dictionary<ReferenceProjectItem, SideTab> tabs = new Dictionary<ReferenceProjectItem, SideTab>();
tabs.Add(new ReferenceProjectItem(project), CreateCustomComponentsSideTab(project));
LoadProjectReferenceSideTabs(project, tabs);
Projects.Add(project, tabs);
}
Dictionary<ReferenceProjectItem, SideTab> references = Projects[project];
foreach (SideTab sideTab in references.Values) {
if (sideTab.Items.Count > 1) {
if (!WorkflowSideBar.Tabs.Contains(sideTab)) {
WorkflowSideBar.Tabs.Add(sideTab);
}
}
}
}
private static SideTab CreateCustomComponentsSideTab(IProject project)
{
AssemblyName assemblyName = new AssemblyName();
assemblyName.CodeBase = project.OutputAssemblyFullPath;
SideTab sideTab = new SideTab("Project components");
sideTab.CanSaved = false;
AddPointerToSideTab(sideTab);
// TODO: Need to load the sidetab with activities from the current project.
// Cannot use LoadSideTabFromAssembly as it will only
// load public components from the assembly.
IProjectContent projectContent = ParserService.GetProjectContent(project);
foreach (IProjectContent pc in projectContent.ReferencedContents){
//LoggingService.DebugFormatted(pc.ToString());
}
SortSideTabItems(sideTab);
return sideTab;
}
private static void RemoveAllSideTabs()
{
foreach (IProject project in Projects.Keys) {
RemoveProjectSideTabs(project);
}
}
private static void RemoveProjectSideTabs(IProject project)
{
if (!Projects.ContainsKey(project))
return;
Dictionary<ReferenceProjectItem, SideTab> references = Projects[project];
foreach (SideTab sideTab in references.Values) {
if (WorkflowSideBar.Tabs.Contains(sideTab)) {
WorkflowSideBar.Tabs.Remove(sideTab);
}
}
}
private static void LoadProjectReferenceSideTabs(IProject project, Dictionary<ReferenceProjectItem, SideTab> tabs)
{
foreach (ProjectItem item in project.Items) {
if (item is ProjectReferenceProjectItem) {
if (File.Exists(((ProjectReferenceProjectItem)item).ReferencedProject.OutputAssemblyFullPath)){
tabs.Add(item as ReferenceProjectItem, CreateSideTabForProjectItem(item));
}
} else if (item is ReferenceProjectItem) {
if (!item.Include.StartsWith("System")){
tabs.Add(item as ReferenceProjectItem, CreateSideTabForProjectItem(item));
}
}
}
}
private static SideTab CreateSideTabForProjectItem(ProjectItem item)
{
AssemblyName assemblyName = null;
if (item is ProjectReferenceProjectItem) {
ProjectReferenceProjectItem pitem = item as ProjectReferenceProjectItem;
assemblyName = new AssemblyName();
assemblyName.CodeBase = pitem.ReferencedProject.OutputAssemblyFullPath;
return CreateSideTabFromAssembly(pitem.ReferencedProject.Name, assemblyName);
} else if (item is ReferenceProjectItem) {
assemblyName = new AssemblyName();
assemblyName.CodeBase = item.FileName;
return CreateSideTabFromAssembly(Path.GetFileNameWithoutExtension(item.FileName) + " components",assemblyName);
}
return null;
}
private static SideTab CreateSideTabFromAssembly(AssemblyName assemblyName)
{
return CreateSideTabFromAssembly(assemblyName.FullName + " components", assemblyName);
}
private static SideTab CreateSideTabFromAssembly(string name, AssemblyName assemblyName)
{
SideTab sideTab = new SideTab(name);
sideTab.CanSaved = false;
AddPointerToSideTab(sideTab);
LoadSideTabItemsFromAssembly(assemblyName, sideTab);
SortSideTabItems(sideTab);
return sideTab;
}
private static void AddPointerToSideTab(SideTab sideTab)
{
// Add the standard pointer.
SharpDevelopSideTabItem sti = new SharpDevelopSideTabItem("Pointer");
sti.CanBeRenamed = false;
sti.CanBeDeleted = false;
Bitmap pointerBitmap = new Bitmap(IconService.GetBitmap("Icons.16x16.FormsDesigner.PointerIcon"), 16, 16);
sti.Icon = pointerBitmap;
sti.Tag = null;
sideTab.Items.Add(sti);
}
private static void LoadSideTabItemsFromAssembly(AssemblyName assemblyName, SideTab sideTab)
{
ICollection toolboxItems = System.Drawing.Design.ToolboxService.GetToolboxItems(assemblyName);
foreach (ToolboxItem tbi in toolboxItems)
{
//TODO: Add further checking to see if this component can actually be put on the sidetab.
SharpDevelopSideTabItem sti = new SharpDevelopSideTabItem(tbi.DisplayName);
sti.CanBeDeleted = false;
sti.CanBeRenamed = false;
sti.Tag = tbi;
sti.Icon = tbi.Bitmap;
sideTab.Items.Add(sti);
}
System.Drawing.Design.ToolboxService.UnloadToolboxItems();
}
private static void SortSideTabItems(SideTab sideTab)
{
SortedDictionary<string, SideTabItem> list = new SortedDictionary<string, SideTabItem>();
SideTabItem pointer = sideTab.Items[0];
sideTab.Items.RemoveAt(0);
foreach (SideTabItem item in sideTab.Items)
list.Add(item.Name, item);
sideTab.Items.Clear();
sideTab.Items.Add(pointer);
foreach (SideTabItem item in list.Values)
sideTab.Items.Add(item);
}
}
}

204
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Src/Services/WorkflowToolboxService.cs

@ -1,204 +0,0 @@ @@ -1,204 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Russell Wilkins" email=""/>
// <version>$Revision$</version>
// </file>
#region Using
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing.Design;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Workflow.Activities;
using ICSharpCode.Core;
using System.Reflection;
using System.Drawing;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Widgets.SideBar;
#endregion
namespace WorkflowDesigner
{
// TODO - Replace this a class based on System.Drawing.Design.ToolboxService
public class WorkflowToolboxService : IToolboxService, IServiceProvider
{
private string category = "Workflow";
public WorkflowToolboxService(IServiceProvider provider)
{
this.provider = provider;
}
#region IServiceProvider implementation
IServiceProvider provider;
public object GetService(Type serviceType)
{
return provider.GetService(serviceType);
}
#endregion
public CategoryNameCollection CategoryNames {
get {
return new CategoryNameCollection(new string[] { "Workflow" });
}
}
public string SelectedCategory {
get {
return category;
}
set {
category = value;
}
}
public void AddCreator(ToolboxItemCreatorCallback creator, string format)
{
throw new NotImplementedException();
}
public void AddCreator(ToolboxItemCreatorCallback creator, string format, System.ComponentModel.Design.IDesignerHost host)
{
throw new NotImplementedException();
}
public void AddLinkedToolboxItem(ToolboxItem toolboxItem, System.ComponentModel.Design.IDesignerHost host)
{
throw new NotImplementedException();
}
public void AddLinkedToolboxItem(ToolboxItem toolboxItem, string category, System.ComponentModel.Design.IDesignerHost host)
{
throw new NotImplementedException();
}
public void AddToolboxItem(ToolboxItem toolboxItem)
{
throw new NotImplementedException();
}
public void AddToolboxItem(ToolboxItem toolboxItem, string category)
{
throw new NotImplementedException();
}
public ToolboxItem DeserializeToolboxItem(object serializedObject)
{
return DeserializeToolboxItem(serializedObject, null);
}
public ToolboxItem DeserializeToolboxItem(object serializedObject, System.ComponentModel.Design.IDesignerHost host)
{
IDataObject dataObject = (System.Windows.Forms.IDataObject)serializedObject;
SharpDevelopSideTabItem sti = (SharpDevelopSideTabItem)dataObject.GetData(typeof(SharpDevelopSideTabItem));
ToolboxItem toolboxItem = (ToolboxItem)sti.Tag;
return toolboxItem;
}
public ToolboxItem GetSelectedToolboxItem()
{
throw new NotImplementedException();
}
public ToolboxItem GetSelectedToolboxItem(System.ComponentModel.Design.IDesignerHost host)
{
throw new NotImplementedException();
}
public ToolboxItemCollection GetToolboxItems()
{
throw new NotImplementedException();
}
public ToolboxItemCollection GetToolboxItems(System.ComponentModel.Design.IDesignerHost host)
{
throw new NotImplementedException();
}
public ToolboxItemCollection GetToolboxItems(string category)
{
throw new NotImplementedException();
}
public ToolboxItemCollection GetToolboxItems(string category, System.ComponentModel.Design.IDesignerHost host)
{
throw new NotImplementedException();
}
public bool IsSupported(object serializedObject, System.ComponentModel.Design.IDesignerHost host)
{
return true;
}
public bool IsSupported(object serializedObject, System.Collections.ICollection filterAttributes)
{
return true;
}
public bool IsToolboxItem(object serializedObject)
{
throw new NotImplementedException();
}
public bool IsToolboxItem(object serializedObject, System.ComponentModel.Design.IDesignerHost host)
{
throw new NotImplementedException();
}
public void Refresh()
{
throw new NotImplementedException();
}
public void RemoveCreator(string format)
{
throw new NotImplementedException();
}
public void RemoveCreator(string format, System.ComponentModel.Design.IDesignerHost host)
{
throw new NotImplementedException();
}
public void RemoveToolboxItem(ToolboxItem toolboxItem)
{
throw new NotImplementedException();
}
public void RemoveToolboxItem(ToolboxItem toolboxItem, string category)
{
throw new NotImplementedException();
}
public void SelectedToolboxItemUsed()
{
throw new NotImplementedException();
}
public object SerializeToolboxItem(ToolboxItem toolboxItem)
{
throw new NotImplementedException();
}
public bool SetCursor()
{
throw new NotImplementedException();
}
public void SetSelectedToolboxItem(ToolboxItem toolboxItem)
{
throw new NotImplementedException();
}
}
}

38
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Templates/Files/CSharp/Activity.xft

@ -1,38 +0,0 @@ @@ -1,38 +0,0 @@
<?xml version="1.0"?>
<Template author="Russell Wilkins" version="1.0">
<Config
name = "Activity"
icon = "Icons.32x32.XMLFileIcon"
category = "Workflow"
subcategory = "C#"
defaultname = "Activity${Number}.xoml"
language = "C#"/>
<Description>Custom Activity</Description>
<Files>
<File name="${Path}/${FileNameWithoutExtension}.xoml.cs" DependentUpon="${FileName}" language="C#"><![CDATA[${StandardHeader.C#}
using System;
using System.Workflow.Activities;
namespace ${StandardNamespace}
{
partial class ${ClassName} : SequenceActivity
{
}
}]]></File>
<File name="${FullName}" language="Xoml" buildAction="Content" SubType="Component"><![CDATA[<SequenceActivity
x:Class="${StandardNamespace}.${ClassName}"
x:Name="${ClassName}"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/workflow" />
]]></File>
</Files>
<AdditionalOptions/>
</Template>

38
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Templates/Files/CSharp/CodeSeparationSequentialWorkflow.xft

@ -1,38 +0,0 @@ @@ -1,38 +0,0 @@
<?xml version="1.0"?>
<Template author="Russell Wilkins" version="1.0">
<Config
name = "Sequential Workflow (Code Separation)"
icon = "Icons.32x32.XMLFileIcon"
category = "Workflow"
subcategory = "C#"
defaultname = "Workflow${Number}.xoml"
language = "C#"/>
<Description>Sequential Workflow (Code Separation)</Description>
<Files>
<File name="${Path}/${FileNameWithoutExtension}.xoml.cs" DependentUpon="${FileName}" language="C#"><![CDATA[${StandardHeader.C#}
using System;
using System.Workflow.Activities;
namespace ${StandardNamespace}
{
public partial class ${ClassName} : SequentialWorkflowActivity
{
}
}]]></File>
<File name="${FullName}" language="Xoml" buildAction="Content" SubType="Component"><![CDATA[<SequentialWorkflowActivity
x:Class="${StandardNamespace}.${ClassName}"
x:Name="${ClassName}"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/workflow" />
]]></File>
</Files>
<AdditionalOptions/>
</Template>

61
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Templates/Files/CSharp/CodeSequentialWorkflow.xft

@ -1,61 +0,0 @@ @@ -1,61 +0,0 @@
<?xml version="1.0"?>
<Template author="Russell Wilkins">
<Config
name = "Sequential Workflow (Code-only)"
icon = "Icons.32x32.XMLFileIcon"
category = "Workflow"
subcategory = "C#"
defaultname = "Workflow${Number}.cs"
language = "C#"/>
<Description>Sequential Workflow (Code-only)</Description>
<Files>
<File name="${Path}/${FileNameWithoutExtension}.Designer.cs" DependentUpon="${FileName}" language="C#"><![CDATA[${StandardHeader.C#}
using System;
using System.Workflow.Activities;
namespace ${StandardNamespace}
{
partial class ${ClassName}
{
private void InitializeComponent()
{
this.Name = "${ClassName}";
}
}
}]]></File>
<File name="${FullName}" language="C#"><![CDATA[${StandardHeader.C#}
using System;
using System.Workflow.Activities;
namespace ${StandardNamespace}
{
public partial class ${ClassName}: SequentialWorkflowActivity
{
public ${ClassName}()
{
//
// The InitializeComponent() call is required for designer support.
//
InitializeComponent();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
}
}]]></File>
</Files>
<AdditionalOptions/>
</Template>

26
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Templates/Files/NoCodeSequentialWorkflow.xft

@ -1,26 +0,0 @@ @@ -1,26 +0,0 @@
<?xml version="1.0"?>
<Template author="Russell Wilkins">
<Config
name = "Sequential Workflow (No Code)"
icon = "Icons.32x32.XMLFileIcon"
category = "Workflow"
defaultname = "Workflow${Number}.xoml"
language = "Xoml"/>
<Description>Sequential Workflow (No Code)</Description>
<Files>
<File name="${FullName}" language="Xoml"><![CDATA[
<SequentialWorkflowActivity x:Class="${StandardNamespace}.${ClassName}" x:Name="${ClassName}" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/workflow">
</SequentialWorkflowActivity>
]]></File>
</Files>
<AdditionalOptions/>
</Template>

103
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Templates/Projects/CSharp/ActivityLibrary.xpt

@ -1,103 +0,0 @@ @@ -1,103 +0,0 @@
<?xml version="1.0"?>
<Template author="Russell Wilkins">
<!-- Template Header -->
<TemplateConfiguration>
<Name>Workflow Activity Library</Name>
<Category>Workflow</Category>
<Subcategory>C#</Subcategory>
<Icon>C#.Project.EmptyProject</Icon>
<Description>A project for creating a reuseable library ofr custom activities for use by other projects</Description>
</TemplateConfiguration>
<Actions>
<Open filename="Activity1.xoml" />
</Actions>
<Project language="C#">
<Imports>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.0\Workflow.Targets" />
</Imports>
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Workflow.Activities" />
<Reference Include="System.Workflow.ComponentModel" />
<Reference Include="System.Workflow.Runtime" />
</ProjectItems>
<PropertyGroup>
<OutputType>Library</OutputType>
</PropertyGroup>
<PropertyGroup escapeValue="false">
<ProjectTypeGuids>{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<Files>
<!-- Assembly -->
<File name="Configuration\AssemblyInfo.cs">
<![CDATA[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("${ProjectName}")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("${ProjectName}")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("1.0.0.0")]
]]>
</File>
<!-- Workflow Code -->
<File name="Activity1.xoml.cs" DependentUpon="Activity1.xoml" language="C#">
<![CDATA[${StandardHeader.C#}
using System;
using System.Workflow.Activities;
namespace ${StandardNamespace}
{
partial class Activity1 : SequenceActivity
{
}
}]]>
</File>
<!-- Workflow -->
<File name="Activity1.xoml" language="Xoml" buildAction="Content" SubType="Component">
<![CDATA[<SequenceActivity
x:Class="${StandardNamespace}.Activity1"
x:Name="Activity1"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/workflow" >
</SequenceActivity>
]]>
</File>
</Files>
</Project>
</Template>

136
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Templates/Projects/CSharp/ConsoleProject.xpt

@ -1,136 +0,0 @@ @@ -1,136 +0,0 @@
<?xml version="1.0"?>
<Template author="Russell Wilkins">
<!-- Template Header -->
<TemplateConfiguration>
<Name>Sequential workflow console project</Name>
<Category>Workflow</Category>
<Subcategory>C#</Subcategory>
<Icon>C#.Project.EmptyProject</Icon>
<Description>A project for creating a sequential workflow console application</Description>
</TemplateConfiguration>
<Actions>
<Open filename="Workflow1.xoml" />
</Actions>
<Project language="C#">
<Imports>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.0\Workflow.Targets" />
</Imports>
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Workflow.Activities" />
<Reference Include="System.Workflow.ComponentModel" />
<Reference Include="System.Workflow.Runtime" />
</ProjectItems>
<PropertyGroup escapeValue="false">
<ProjectTypeGuids>{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<Files>
<!-- Main -->
<File name="Main.cs">
<![CDATA[${StandardHeader.C#}
using System;
using System.Threading;
using System.Workflow.Runtime;
using System.Workflow.Runtime.Hosting;
namespace ${StandardNamespace}
{
class MainClass
{
public static void Main(string[] args)
{
using(WorkflowRuntime workflowRuntime = new WorkflowRuntime()) {
AutoResetEvent waitEvent = new AutoResetEvent(false);
workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e) {
waitEvent.Set();
};
workflowRuntime.WorkflowTerminated += delegate(object sender, WorkflowTerminatedEventArgs e) {
Console.WriteLine(e.Exception.Message);
waitEvent.Set();
};
WorkflowInstance workflowInstance = workflowRuntime.CreateWorkflow(typeof(${StandardNamespace}.Workflow1));
workflowInstance.Start();
waitEvent.WaitOne();
}
}
}
}]]>
</File>
<!-- Assembly -->
<File name="Configuration\AssemblyInfo.cs">
<![CDATA[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("${ProjectName}")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("${ProjectName}")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("1.0.0.0")]
]]>
</File>
<!-- Workflow Code -->
<File name="Workflow1.xoml.cs" DependentUpon="Workflow1.xoml" language="C#">
<![CDATA[${StandardHeader.C#}
using System;
using System.Workflow.Activities;
namespace ${StandardNamespace}
{
public partial class Workflow1 : SequentialWorkflowActivity
{
}
}]]>
</File>
<!-- Workflow -->
<File name="Workflow1.xoml" language="Xoml" buildAction="Content" SubType="Component">
<![CDATA[<SequentialWorkflowActivity
x:Class="${StandardNamespace}.Workflow1"
x:Name="Workflow1"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/workflow" >
</SequentialWorkflowActivity>
]]>
</File>
</Files>
</Project>
</Template>

69
src/AddIns/DisplayBindings/WorkflowDesigner/Project/Templates/Projects/CSharp/EmptyProject.xpt

@ -1,69 +0,0 @@ @@ -1,69 +0,0 @@
<?xml version="1.0"?>
<Template author="Russell Wilkins">
<!-- Template Header -->
<TemplateConfiguration>
<Name>Empty workflow project</Name>
<Category>Workflow</Category>
<Subcategory>C#</Subcategory>
<Icon>C#.Project.EmptyProject</Icon>
<Description>Empty workflow project</Description>
</TemplateConfiguration>
<Project language="C#" >
<Imports>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.0\Workflow.Targets" />
</Imports>
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Workflow.Activities" />
<Reference Include="System.Workflow.ComponentModel" />
<Reference Include="System.Workflow.Runtime" />
</ProjectItems>
<PropertyGroup escapeValue="false">
<ProjectTypeGuids>{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<Files>
<!-- Assembly -->
<File name="Configuration\AssemblyInfo.cs">
<![CDATA[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("${ProjectName}")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("${ProjectName}")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("1.0.0.0")]
]]>
</File>
</Files>
</Project>
</Template>

46
src/AddIns/DisplayBindings/WorkflowDesigner/Project/WorkflowDesigner.addin

@ -1,46 +0,0 @@ @@ -1,46 +0,0 @@
<AddIn name = "Workflow Foundation Designer"
author = "Russell Wilkins"
url = ""
description = "Windows Workflow Foundation Designer">
<Runtime>
<Import assembly = "WorkflowDesigner.dll"/>
</Runtime>
<Manifest>
<Identity name="WorkflowDesigner" version="@WorkflowDesigner.dll"/>
<Dependency addin="SharpDevelop" version="3.0"/>
</Manifest>
<!--Primary View -->
<Path name="/SharpDevelop/Workbench/FileFilter">
<FileFilter id = "WorkflowFileFilter"
name = "Workflow (*.xoml)"
extensions = "*.xoml"
insertbefore = "Boo"/>
</Path>
<Path name = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "WorkflowDisplayBinding"
class = "WorkflowDesigner.WorkflowPrimaryDisplayBinding"
insertbefore = "Text"
fileNamePattern = "\.(xoml)$"
languagePattern = "^Xoml$"
/>
</Path>
<!--Secondary View -->
<Path name = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "WorkflowDesignerSecondary"
type = "Secondary"
class = "WorkflowDesigner.WorkflowDesignerSecondaryDisplayBinding"
fileNamePattern = "\.cs?$" />
</Path>
<!--Template path -->
<Path name = "/SharpDevelop/BackendBindings/Templates">
<Directory id = "WorkflowDesigner" path = "./Templates" />
</Path>
</AddIn>

170
src/AddIns/DisplayBindings/WorkflowDesigner/Project/WorkflowDesigner.csproj

@ -1,170 +0,0 @@ @@ -1,170 +0,0 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{533F4684-DBA6-4518-B005-C84F22A2DD57}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<RootNamespace>WorkflowDesigner</RootNamespace>
<AssemblyName>WorkflowDesigner</AssemblyName>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>..\..\..\..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<Optimize>False</Optimize>
<StartAction>Program</StartAction>
<StartProgram>..\..\..\..\..\bin\SharpDevelop.exe</StartProgram>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>..\..\..\..\..\AddIns\AddIns\DisplayBindings\WorkflowDesigner\</OutputPath>
<DebugSymbols>false</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE</DefineConstants>
<Optimize>False</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="System">
<Private>False</Private>
</Reference>
<Reference Include="System.Data">
<Private>False</Private>
</Reference>
<Reference Include="System.Design" />
<Reference Include="System.Drawing">
<Private>False</Private>
</Reference>
<Reference Include="System.Drawing.Design" />
<Reference Include="System.Windows.Forms">
<Private>False</Private>
</Reference>
<Reference Include="System.Workflow.Activities">
<Private>False</Private>
</Reference>
<Reference Include="System.Workflow.ComponentModel">
<Private>False</Private>
</Reference>
<Reference Include="System.Workflow.Runtime" />
<Reference Include="System.Xml">
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="Templates\Files\CSharp\Activity.xft">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Templates\Files\CSharp\CodeSeparationSequentialWorkflow.xft">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Templates\Files\CSharp\CodeSequentialWorkflow.xft">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Templates\Projects\CSharp\ActivityLibrary.xpt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Templates\Projects\CSharp\ConsoleProject.xpt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Templates\Projects\CSharp\EmptyProject.xpt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="WorkflowDesigner.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\Gui\ViewContentControl.cs" />
<Compile Include="Src\Gui\ViewContentControl.Designer.cs">
<DependentUpon>ViewContentControl.cs</DependentUpon>
</Compile>
<Compile Include="Src\Loaders\BasicWorkflowDesignerLoader.cs" />
<Compile Include="Src\Loaders\CodeDesignerLoader.cs" />
<Compile Include="Src\Loaders\WorkflowDesignerLoadException.cs" />
<Compile Include="Src\Loaders\XomlDesignerLoader.cs" />
<Compile Include="Src\PrimaryView\PrimaryDisplayBinding.cs" />
<Compile Include="Src\PrimaryView\PrimaryViewContent.cs" />
<Compile Include="Src\SecondaryView\SecondaryDisplayBinding.cs" />
<Compile Include="Src\SecondaryView\SecondaryViewContent.cs" />
<Compile Include="Src\Services\EventBindingService\CSharpWorkflowDesignerEventBindingService.cs" />
<Compile Include="Src\Services\EventBindingService\EventPropertyDescriptor.cs" />
<Compile Include="Src\Services\EventBindingService\IWorkflowDesignerEventBindingService.cs" />
<Compile Include="Src\Services\EventBindingService\WorkflowDesignerEventBindingService.cs" />
<Compile Include="Src\Services\MemberCreationService.cs" />
<Compile Include="Src\Services\PropertyValueUIService.cs" />
<Compile Include="Src\Services\TypeProviderService.cs" />
<Compile Include="Src\Services\TypeResolutionService.cs" />
<Compile Include="Src\Services\WorkflowSideTabService.cs" />
<Compile Include="Src\Services\WorkflowMenuCommandService.cs" />
<Compile Include="Src\Services\WorkflowToolboxService.cs" />
<None Include="Templates\Files\NoCodeSequentialWorkflow.xft">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj">
<Project>{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}</Project>
<Name>ICSharpCode.TextEditor</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Libraries\NRefactory\Project\NRefactory.csproj">
<Project>{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}</Project>
<Name>NRefactory</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj">
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project>
<Name>ICSharpCode.SharpDevelop.Dom</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Sda\ICSharpCode.SharpDevelop.Sda.csproj">
<Project>{80318B5F-A25D-45AB-8A95-EF31D2370A4C}</Project>
<Name>ICSharpCode.SharpDevelop.Sda</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj">
<Project>{8035765F-D51F-4A0C-A746-2FD100E19419}</Project>
<Name>ICSharpCode.SharpDevelop.Widgets</Name>
<Private>False</Private>
</ProjectReference>
<Folder Include="Src\Gui" />
<Folder Include="Src\Loaders" />
<Folder Include="Src\Commands" />
<Folder Include="Src\PrimaryView" />
<Folder Include="Src\Services" />
<Folder Include="Src\Services\EventBindingService" />
<Folder Include="Templates" />
<Folder Include="Src\SecondaryView" />
<Folder Include="Templates\Files" />
<Folder Include="Templates\Files\CSharp" />
<Folder Include="Templates\Files\VB" />
<Folder Include="Templates\Projects" />
<Folder Include="Templates\Projects\CSharp" />
<Folder Include="Templates\Projects\VB" />
</ItemGroup>
</Project>

2
src/AddIns/Misc/ReflectorAddIn/ReflectorAddIn/Project/ReflectorAddIn.addin

@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
description = "Can open Lutz Roeder's .NET Reflector on a selected class or member.">
<Manifest>
<Identity name="ReflectorAddIn" version="@ReflectorAddIn.dll" />
<Identity name="ReflectorAddIn" />
</Manifest>
<Runtime>

15
src/AddIns/Misc/SharpServerTools/DataTools.Model/Configuration/AssemblyInfo.cs

@ -1,15 +0,0 @@ @@ -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("")]

63
src/AddIns/Misc/SharpServerTools/DataTools.Model/DataTools.Model.csproj

@ -1,63 +0,0 @@ @@ -1,63 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{51783FC4-D8D2-4BFB-A1F1-AC8857CF3ED0}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<RootNamespace>ICSharpCode.DataTools.Model</RootNamespace>
<AssemblyName>ICSharpCode.DataTools.Model</AssemblyName>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<Optimize>False</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\</OutputPath>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\..\..\..\Libraries\log4net\log4net.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\ColumnNames.cs" />
<Compile Include="Src\DbModelInfo.cs" />
<Compile Include="Src\DbModelInfoService.cs" />
<Compile Include="Src\DbProvidersException.cs" />
<Compile Include="Src\DbProvidersService.cs" />
<Compile Include="Src\MetadataNames.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Configuration" />
<Folder Include="Resources" />
<Folder Include="Src" />
</ItemGroup>
</Project>

22
src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/ColumnNames.cs

@ -1,22 +0,0 @@ @@ -1,22 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision: 1784 $</version>
// </file>
using System;
namespace SharpDbTools.Data
{
/// <summary>
/// Description of Columns.
/// </summary>
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";
}
}

170
src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbModelInfo.cs

@ -1,170 +0,0 @@ @@ -1,170 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision: 1784 $</version>
// </file>
using System;
using System.Data;
namespace SharpDbTools.Data
{
/// <summary>
/// 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.
/// </summary>
///
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];
}
}
}
}

301
src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbModelInfoService.cs

@ -1,301 +0,0 @@ @@ -1,301 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision: 1784 $</version>
// </file>
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.IO;
using log4net;
namespace SharpDbTools.Data
{
/// <summary>
/// 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
/// </summary>
public static class DbModelInfoService
{
const string dbFilesDir = "DbTools";
static SortedList<string, DbModelInfo> 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<string> Names {
get {
if (cache == null) {
cache = new SortedList<string, DbModelInfo>();
LoadNamesFromFiles();
}
return cache.Keys;
}
}
/// <summary>
///
/// </summary>
/// <param name="name">The user readable name of the provider</param>
/// <param name="invariantName">the identifying name of the provider</param>
/// <param name="connectionString">the connection string for this connection</param>
/// <returns></returns>
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();
}
}
/// <summary>
///
/// </summary>
/// <param name="name">the logical name of the DbModelInfo to save to a file</param>
/// <param name="overwriteExistingFile">if true, any existing file will be overwritten</param>
/// <returns>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</returns>
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 <name>.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;
}
}
}
}

40
src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbProvidersException.cs

@ -1,40 +0,0 @@ @@ -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
{
/// <summary>
/// Thrown when the DbProvidersService cannot find the class for
/// a DbProviderFactory that is found in a *.config file.
/// </summary>
[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)
{
}
}
}

132
src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/DbProvidersService.cs

@ -1,132 +0,0 @@ @@ -1,132 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision: 1697 $</version>
// </file>
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using log4net;
namespace SharpDbTools.Data
{
/// <summary>
/// A utility class that caches the DbProviderFactory and DbConnectionString
/// objects whose state is stored in the current processes config space.
/// </summary>
public class DbProvidersService
{
private static DbProvidersService me = new DbProvidersService();
private static Boolean initialized = false;
private Dictionary<string, DbProviderFactory> factories = new Dictionary<string, DbProviderFactory>();
private Dictionary<string, DbProviderFactory> factoriesByInvariantName = new Dictionary<string, DbProviderFactory>();
// This is only valid witin one session - do not persist
private Dictionary<string, string> invariantByNameLookup = new Dictionary<string, string>();
private List<string> names = new List<string>();
static ILog log = LogManager.GetLogger(typeof(DbProvidersService));
List<string> errMsgs = new List<string>();
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<string> errorMsgs = new List<string>();
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<string> ErrorMessages {
get {
return this.errMsgs;
}
}
public List<string> 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;
}
}
}

22
src/AddIns/Misc/SharpServerTools/DataTools.Model/Src/MetadataNames.cs

@ -1,22 +0,0 @@ @@ -1,22 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision: 1784 $</version>
// </file>
using System;
namespace SharpDbTools.Data
{
/// <summary>
/// Description of Tables.
/// </summary>
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";
}
}

15
src/AddIns/Misc/SharpServerTools/DataTools.UI/Configuration/AssemblyInfo.cs

@ -1,15 +0,0 @@ @@ -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("")]

65
src/AddIns/Misc/SharpServerTools/DataTools.UI/DataTools.UI.csproj

@ -1,65 +0,0 @@ @@ -1,65 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{87C0E3D9-0DFD-4F6D-8E38-408AAF73F4EE}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<RootNamespace>ICSharpCode.DataTools.UI</RootNamespace>
<AssemblyName>ICSharpCode.DataTools.UI</AssemblyName>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<Optimize>False</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\</OutputPath>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\ConnectionStringDefinitionDialog.cs" />
<Compile Include="Src\ConnectionStringDefinitionDialog.Designer.cs" />
<EmbeddedResource Include="Resources\Strings.resx" />
<EmbeddedResource Include="Src\ConnectionStringDefinitionDialog.resx">
<DependentUpon>ConnectionStringDefinitionDialog.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Configuration" />
<Folder Include="Resources" />
<Folder Include="Src" />
<ProjectReference Include="..\DataTools.Model\DataTools.Model.csproj">
<Project>{51783FC4-D8D2-4BFB-A1F1-AC8857CF3ED0}</Project>
<Name>DataTools.Model</Name>
</ProjectReference>
</ItemGroup>
</Project>

205
src/AddIns/Misc/SharpServerTools/DataTools.UI/Resources/Strings.resx

@ -1,205 +0,0 @@ @@ -1,205 +0,0 @@
<?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>
<data name="SharpDbTools.Data.PrimaryObjects.Tables" xml:space="preserve">
<value>Tables</value>
</data>
<data name="SharpDbTools.Data.PrimaryObjects.Procedures" xml:space="preserve">
<value>Procedures</value>
</data>
<data name="SharpDbTools.Data.PrimaryObjects.Functions" xml:space="preserve">
<value>Functions
</value>
</data>
<data name="SharpDbTools.Data.PrimaryObjects.Views" xml:space="preserve">
<value>Views</value>
</data>
<data name="SharpDbTools.Data.PrimaryObjects.Users" xml:space="preserve">
<value>Users</value>
</data>
<data name="SharpDbTools.Forms.DbObjectNodeName" xml:space="preserve">
<value>Db Objects</value>
</data>
<data name="SharpDbTools.Forms.DbExplorerNodeName" xml:space="preserve">
<value>Database Explorer</value>
</data>
<data name="SharpDbTools.Forms.AddConnectionMenu" xml:space="preserve">
<value>Add Connection</value>
</data>
<data name="SharpDbTools.Forms.DeleteConnectionMenu" xml:space="preserve">
<value>Delete Connection</value>
</data>
<data name="SharpDbTools.Forms.SaveAllMenu" xml:space="preserve">
<value>Save All</value>
</data>
<data name="SharpDbTools.Forms.ConnectionPropertiesNodeName" xml:space="preserve">
<value>Connection Properties</value>
</data>
<data name="SharpDbTools.Forms.NoMetadataNodeName" xml:space="preserve">
<value>No Metadata</value>
</data>
<data name="SharpDbTools.Forms.SetConnectionStringMenu" xml:space="preserve">
<value>Set Connection String</value>
</data>
<data name="SharpDbTools.Forms.LoadMetadataFromConnectionMenu" xml:space="preserve">
<value>Load Metadata From Connection</value>
</data>
<data name="SharpDbTools.Forms.LoadMetadataFromFileMenu" xml:space="preserve">
<value>Load Metadata From File</value>
</data>
<data name="SharpDbTools.Forms.OpenSQLToolMenu" xml:space="preserve">
<value>Open SQL Tool</value>
</data>
<data name="SharpDbTools.Forms.ConnectionStringNodeName" xml:space="preserve">
<value>Connection String:</value>
</data>
<data name="SharpDbTools.Forms.InvariantNameNodeName" xml:space="preserve">
<value>Invariant Name:</value>
</data>
<data name="SharpDbTools.Forms.ConnectionSucceededMsg" xml:space="preserve">
<value>Connection Succeeded</value>
</data>
<data name="SharpDbTools.Forms.ConnectionFailedMsg" xml:space="preserve">
<value>Connection Failed</value>
</data>
<data name="SharpDbTools.Forms.TestButton" xml:space="preserve">
<value>Test</value>
</data>
<data name="SharpDbTools.Forms.SubmitButton" xml:space="preserve">
<value>Submit</value>
</data>
<data name="SharpDbTools.Forms.CancelButton" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="SharpDbTools.Forms.DataSourceTypeLabel" xml:space="preserve">
<value>Data Source Type:</value>
</data>
<data name="SharpDbTools.Forms.ConnectionStringLabel" xml:space="preserve">
<value>Connection String:</value>
</data>
<data name="SharpDbTools.Forms.ConnectionStringTab" xml:space="preserve">
<value>Connection String</value>
</data>
<data name="SharpDbTools.Forms.TestResultTab" xml:space="preserve">
<value>Test Result Message</value>
</data>
<data name="SharpDbTools.Forms.ConnectionStringDefinitionDialog" xml:space="preserve">
<value>Set Up Connection String</value>
</data>
</root>

236
src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.Designer.cs generated

@ -1,236 +0,0 @@ @@ -1,236 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision$</version>
// </file>
namespace SharpDbTools.Forms
{
partial class ConnectionStringDefinitionDialog : System.Windows.Forms.Form
{
/// <summary>
/// Designer variable used to keep track of non-visual components.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Disposes resources used by the form.
/// </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.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;
}
}

286
src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.cs

@ -1,286 +0,0 @@ @@ -1,286 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision: 1684 $</version>
// </file>
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
{
/// <summary>
/// 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.
/// </summary>
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<string> 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;
}
}
}
}

126
src/AddIns/Misc/SharpServerTools/DataTools.UI/Src/ConnectionStringDefinitionDialog.resx

@ -1,126 +0,0 @@ @@ -1,126 +0,0 @@
<?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>
<metadata name="progressTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>247, 17</value>
</metadata>
<metadata name="statusStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>371, 17</value>
</metadata>
</root>

120
src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Resources/Strings.resx

@ -1,120 +0,0 @@ @@ -1,120 +0,0 @@
<?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>

75
src/AddIns/Misc/SharpServerTools/ServerBrowserTool/ServerBrowserTool.csproj

@ -1,75 +0,0 @@ @@ -1,75 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>ICSharpCode.ServerBrowserTool</RootNamespace>
<AssemblyName>ICSharpCode.ServerBrowserTool</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D721EAA4-8A40-4EF0-A011-5862159BE621}</ProjectGuid>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\</OutputPath>
<Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\</OutputPath>
<Optimize>True</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Drawing" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Src\Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Src\Forms\ISupportsDragDrop.cs" />
<Compile Include="Src\Forms\ServerToolTreeView.cs" />
<Compile Include="Src\Forms\IInitializable.cs" />
<Compile Include="Src\Forms\NodeAwareContextMenuStrip.cs" />
<Compile Include="Src\Forms\RebuildRequiredEvents.cs" />
<Compile Include="Src\Forms\ServerBrowserTool.cs" />
<Compile Include="Src\Configuration\AssemblyInfo.cs" />
<Compile Include="Src\Forms\ProgressEllipsis.cs" />
<EmbeddedResource Include="Resources\Strings.resx" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources" />
<Folder Include="Src" />
<Folder Include="Src\Configuration" />
<Folder Include="Src\Forms" />
<Content Include="SharpServerTools.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

6
src/AddIns/Misc/SharpServerTools/ServerBrowserTool/ServerBrowserTool.sln

@ -1,6 +0,0 @@ @@ -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

48
src/AddIns/Misc/SharpServerTools/ServerBrowserTool/SharpServerTools.addin

@ -1,48 +0,0 @@ @@ -1,48 +0,0 @@
<AddIn name = "SharpDbTools"
author = "Dickon Field"
url = ""
description = "A collection of components and tools to help develop db-aware apps... and more">
<Manifest>
<Identity name = "ICSharpCode.SharpServerTools"/>
</Manifest>
<Runtime>
<Import assembly = "ICSharpCode.ServerBrowserTool.dll"/>
<Import assembly="ICSharpCode.DataTools.AddIn.dll"/>
<Import assembly="ICSharpCode.DataTools.UI.dll"/>
<Import assembly="ICSharpCode.DataTools.Model.dll"/>
</Runtime>
<Path name = "/SharpDevelop/Workbench/Pads">
<Pad id = "SharpServerToolsPad"
category = "Main"
title = "Server Explorer"
icon = "ServerTool.Server"
shortcut = "Control|Alt|D"
class = "SharpServerTools.Forms.ServerBrowserTool"/>
</Path>
<Path name = "/SharpServerTools/SharpDbTools/FormsArtefactFactory">
<Class id = "System.Data.SQLite"
class = "SharpDbTools.SQLite.Forms.SQLiteFormsArtefactFactory"/>
</Path>
<Path name = "/SharpServerTools/SharpDbTools/FormsArtefactFactory">
<Class id = "System.Data.OracleClient"
class = "SharpDbTools.Oracle.Forms.OracleFormsArtefactFactory"/>
</Path>
<Path name = "/SharpServerTools/SharpDbTools/FormsArtefactFactory">
<Class id = "System.Data.SqlClient"
class = "SharpDbTools.SQLServer.Forms.SQLServerFormsArtefactFactory"/>
</Path>
<Path name = "/SharpServerTools/ServerTool">
<Class id = "DatabaseExplorer"
class = "SharpDbTools.Forms.DatabaseExplorerTreeNode"/>
</Path>
</AddIn>

21
src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Configuration/AssemblyInfo.cs

@ -1,21 +0,0 @@ @@ -1,21 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision$</version>
// </file>
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("")]

19
src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/IInitializable.cs

@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision$</version>
// </file>
using System;
namespace SharpServerTools.Forms
{
/// <summary>
/// Implemented by anything that is initializable
/// </summary>
public interface IInitializable
{
void Initialize();
}
}

23
src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ISupportsDragDrop.cs

@ -1,23 +0,0 @@ @@ -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
{
/// <summary>
/// This interface is implemented by any plugin to ServerExplorer that supports drag and drop
/// of some of its data
/// </summary>
public interface ISupportsDragDrop
{
void HandleMouseDownEvent(object sender, MouseEventArgs e);
}
}

28
src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/NodeAwareContextMenuStrip.cs

@ -1,28 +0,0 @@ @@ -1,28 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision$</version>
// </file>
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;
}
}
}
}

56
src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ProgressEllipsis.cs

@ -1,56 +0,0 @@ @@ -1,56 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Text;
namespace SharpServerTools.Forms
{
/// <summary>
/// Shows progress as a series of ellipses. Not threadsafe.
/// </summary>
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;
}
}
}
}

54
src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/RebuildRequiredEvents.cs

@ -1,54 +0,0 @@ @@ -1,54 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
namespace SharpServerTools.Forms
{
/// <summary>
/// An IRebuildable can be asked to rebuild its Node tree
/// </summary>
public interface IRebuildable
{
void Rebuild();
}
/// <summary>
/// An IRequiresRebuildSource can request the ServerToolTreeView to rebuild
/// it by emitting the RebuildRequiredEvent
/// </summary>
public interface IRequiresRebuildSource
{
event RebuildRequiredEventHandler RebuildRequiredEvent;
}
public delegate void RebuildRequiredEventHandler(object sender, RebuildRequiredEventArgs e);
/// <summary>
/// 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.
/// </summary>
public class RebuildRequiredEventArgs: EventArgs
{
List<IRebuildable> rebuildNodes = new List<IRebuildable>();
public IEnumerable<IRebuildable> Nodes {
get {
return rebuildNodes;
}
}
public void AddNode(IRebuildable node)
{
rebuildNodes.Add(node);
}
}
}

64
src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ServerBrowserTool.cs

@ -1,64 +0,0 @@ @@ -1,64 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
namespace SharpServerTools.Forms
{
/// <summary>
/// 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.
/// </summary>
public class ServerBrowserTool : AbstractPadContent
{
Panel ctl;
ServerToolTreeView dbTree;
/// <summary>
/// ServerBrowserTool hosts one or more TreeViews providing views of types
/// of server. Currently it shows only relational database servers.
/// </summary>
public ServerBrowserTool()
{
LoggingService.Debug("Loading ServerBrowserTool");
dbTree = new ServerToolTreeView();
dbTree.Dock = DockStyle.Fill;
ctl = new Panel();
ctl.Controls.Add(dbTree);
dbTree.Rebuild();
}
/// <summary>
/// The <see cref="System.Windows.Forms.Control"/> representing the pad
/// </summary>
public override Control Control {
get {
return ctl;
}
}
/// <summary>
/// Rebuildes the pad
/// </summary>
public override void RedrawContent()
{
}
/// <summary>
/// Cleans up all used resources
/// </summary>
public override void Dispose()
{
ctl.Dispose();
}
}
}

108
src/AddIns/Misc/SharpServerTools/ServerBrowserTool/Src/Forms/ServerToolTreeView.cs

@ -1,108 +0,0 @@ @@ -1,108 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;
using ICSharpCode.Core;
namespace SharpServerTools.Forms
{
/// <summary>
/// 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.
/// </summary>
public class ServerToolTreeView : TreeView, IRebuildable
{
public const string SERVERTOOL_PATH = "/SharpServerTools/ServerTool";
public ServerToolTreeView(): base()
{
AddInTreeNode node =
AddInTree.GetTreeNode(SERVERTOOL_PATH);
List<Codon> 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);
}

109
src/AddIns/Misc/SharpServerTools/SharpDbTools/DataTools.AddIn.csproj

@ -1,109 +0,0 @@ @@ -1,109 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>ICSharpCode.DataTools.AddIn</RootNamespace>
<AssemblyName>ICSharpCode.DataTools.AddIn</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{93B2D6DF-7588-40C0-8A35-CA0DD7328FC3}</ProjectGuid>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\</OutputPath>
<Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\SharpServerTools\</OutputPath>
<Optimize>True</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Src\Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Src\Configuration\AssemblyInfo.cs" />
<Compile Include="Src\Forms.TextEditor\SQLTextEditorControl.cs" />
<Compile Include="Src\Forms\SQLTool.cs" />
<Compile Include="Src\Forms\SQLTool.Designer.cs">
<DependentUpon>SQLTool.cs</DependentUpon>
</Compile>
<Compile Include="Src\Forms\SQLToolResourceSyntaxModeProvider.cs" />
<Compile Include="Src\Forms\SQLToolViewContent.cs" />
<Compile Include="Src\Forms\TableDescribeViewContent.cs" />
<Compile Include="Src\Forms\DatabaseExplorerTreeNode.cs" />
<Compile Include="Src\Forms\DbModelInfoTreeNode.cs" />
<Compile Include="Src\Forms\FormsArtefactFactories.cs" />
<Compile Include="Src\Forms\FormsArtefactFactory.cs" />
<EmbeddedResource Include="Resources\Strings.resx" />
<EmbeddedResource Include="Src\Forms\SQLTool.resx">
<DependentUpon>SQLTool.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="Src\Forms\TableTreeNode.cs" />
<Compile Include="Src\Provider\OracleFormsArtefactFactory.cs" />
<Compile Include="Src\Provider\SQLiteArtefactFactory.cs" />
<Compile Include="Src\Provider\SQLServerFormsArtefactFactory.cs" />
<EmbeddedResource Include="Resources\SQL.xshd" />
<EmbeddedResource Include="Resources\SyntaxModes.xml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources" />
<Folder Include="Src" />
<Folder Include="Src\Configuration" />
<Folder Include="Src\Data" />
<Folder Include="Src\Forms" />
<Folder Include="Src\Forms.TextEditor" />
<Folder Include="Src\Provider" />
<ProjectReference Include="..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj">
<Project>{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}</Project>
<Name>ICSharpCode.TextEditor</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\DataTools.Model\DataTools.Model.csproj">
<Project>{51783FC4-D8D2-4BFB-A1F1-AC8857CF3ED0}</Project>
<Name>DataTools.Model</Name>
</ProjectReference>
<ProjectReference Include="..\DataTools.UI\DataTools.UI.csproj">
<Project>{87C0E3D9-0DFD-4F6D-8E38-408AAF73F4EE}</Project>
<Name>DataTools.UI</Name>
</ProjectReference>
<ProjectReference Include="..\ServerBrowserTool\ServerBrowserTool.csproj">
<Project>{D721EAA4-8A40-4EF0-A011-5862159BE621}</Project>
<Name>ServerBrowserTool</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

159
src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/SQL.xshd

@ -1,159 +0,0 @@ @@ -1,159 +0,0 @@
<?xml version = "1.0"?>
<!-- Thanks to Troy@ebswift.com -->
<SyntaxDefinition name = "SQL" extensions = ".sql">
<Environment>
<Default color = "SystemColors.WindowText" bgcolor="SystemColors.Window"/>
<VRuler color = "Blue"/>
<Selection bgcolor = "LightBlue"/>
<LineNumbers color = "Teal" bgcolor = "SystemColors.Window"/>
<InvalidLines color = "Red"/>
<EOLMarkers color = "White"/>
<SpaceMarkers color = "#E0E0E5"/>
<TabMarkers color = "#E0E0E5"/>
<CaretMarker color = "Yellow"/>
<FoldLine color = "#808080" bgcolor="Black"/>
<FoldMarker color = "#808080" bgcolor="White"/>
</Environment>
<Properties>
<Property name="LineComment" value="--"/>
</Properties>
<Digits name = "Digits" bold = "false" italic = "false" color = "DarkBlue"/>
<RuleSets>
<RuleSet ignorecase = "true">
<Delimiters>=!&gt;&lt;+-/*%&amp;|^~.}{,;][?:()</Delimiters>
<Span name ="LineComment" bold ="false" italic ="true" color ="DarkGreen" stopateol ="true">
<Begin>--</Begin>
</Span>
<Span name ="BlockComment" bold ="false" italic ="false" color ="DarkGreen" stopateol ="false">
<Begin>/*</Begin>
<End>*/</End>
</Span>
<Span name ="String" bold ="false" italic ="false" color ="Sienna" stopateol ="false">
<Begin>&quot;</Begin>
<End>&quot;</End>
</Span>
<Span name = "Character" bold = "false" italic = "false" color = "Sienna" stopateol = "true">
<Begin>&apos;</Begin>
<End>&apos;</End>
</Span>
<KeyWords name ="SqlKeywords" bold="false" italic = "false" color = "Blue">
<Key word = "from" />
<Key word = "where" />
<Key word = "in" />
<Key word = "on" />
<Key word = "exists" />
<Key word = "or" />
<Key word = "and" />
<Key word = "not" />
<Key word = "null" />
<Key word = "having" />
<Key word = "group" />
<Key word = "by" />
<Key word = "order" />
<Key word = "into" />
<Key word = "values" />
<Key word = "set" />
<Key word = "inner" />
<Key word = "outer" />
<Key word = "join" />
<Key word = "union" />
<Key word = "desc" />
<Key word = "asc" />
</KeyWords>
<KeyWords name ="SqlActionWords" bold="false" italic = "false" color = "Blue">
<Key word = "select" />
<Key word = "update" />
<Key word = "use" />
<Key word = "insert" />
<Key word = "create" />
<Key word = "drop" />
<Key word = "delete" />
<Key word = "truncate" />
<Key word = "alter" />
<Key word = "add" />
</KeyWords>
<KeyWords name ="SqlTypes" bold="false" italic = "false" color = "DarkRed">
<Key word = "varchar" />
<Key word = "nvarchar" />
<Key word = "char" />
<Key word = "nchar" />
<Key word = "int" />
<Key word = "text" />
<Key word = "ntext" />
<Key word = "double" />
<Key word = "money" />
<Key word = "bit" />
</KeyWords>
<KeyWords name ="SqlObjects" bold="false" italic = "false" color = "DarkRed">
<Key word = "table" />
<Key word = "proc" />
<Key word = "procedure" />
<Key word = "function" />
<Key word = "view" />
<Key word = "trigger" />
<Key word = "index" />
<Key word = "database" />
</KeyWords>
<KeyWords name ="TSql" bold="false" italic = "false" color = "DarkBlue">
<Key word = "IF" />
<Key word = "ELSE" />
<Key word = "CASE" />
<Key word = "RETURN" />
<Key word = "END" />
<Key word = "DECLARE" />
<Key word = "SWITCH" />
<Key word = "END" />
<Key word = "BEGIN" />
<Key word = "CASE" />
<Key word = "WHEN" />
<Key word = "END" />
</KeyWords>
<KeyWords name ="Punctuation" bold="false" italic = "false" color = "DarkSlateGray">
<Key word = "(" />
<Key word = ")" />
</KeyWords>
<KeyWords name ="Operators" bold="false" italic = "false" color = "DarkSlateGray">
<Key word = "&lt;" />
<Key word = "&gt;" />
<Key word = "=" />
</KeyWords>
<KeyWords name ="Functions" bold="false" italic = "false" color = "DarkRed">
<Key word = "substring" />
<Key word = "upper" />
<Key word = "lower" />
<Key word = "reverse" />
<Key word = "avg" />
<Key word = "min" />
<Key word = "max" />
<Key word = "replace" />
<Key word = "ltrim" />
<Key word = "rtrim" />
<Key word = "cast" />
</KeyWords>
</RuleSet>
</RuleSets>
</SyntaxDefinition>

205
src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/Strings.resx

@ -1,205 +0,0 @@ @@ -1,205 +0,0 @@
<?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>
<data name="SharpDbTools.Data.PrimaryObjects.Tables" xml:space="preserve">
<value>Tables</value>
</data>
<data name="SharpDbTools.Data.PrimaryObjects.Procedures" xml:space="preserve">
<value>Procedures</value>
</data>
<data name="SharpDbTools.Data.PrimaryObjects.Functions" xml:space="preserve">
<value>Functions
</value>
</data>
<data name="SharpDbTools.Data.PrimaryObjects.Views" xml:space="preserve">
<value>Views</value>
</data>
<data name="SharpDbTools.Data.PrimaryObjects.Users" xml:space="preserve">
<value>Users</value>
</data>
<data name="SharpDbTools.Forms.DbObjectNodeName" xml:space="preserve">
<value>Db Objects</value>
</data>
<data name="SharpDbTools.Forms.DbExplorerNodeName" xml:space="preserve">
<value>Database Explorer</value>
</data>
<data name="SharpDbTools.Forms.AddConnectionMenu" xml:space="preserve">
<value>Add Connection</value>
</data>
<data name="SharpDbTools.Forms.DeleteConnectionMenu" xml:space="preserve">
<value>Delete Connection</value>
</data>
<data name="SharpDbTools.Forms.SaveAllMenu" xml:space="preserve">
<value>Save All</value>
</data>
<data name="SharpDbTools.Forms.ConnectionPropertiesNodeName" xml:space="preserve">
<value>Connection Properties</value>
</data>
<data name="SharpDbTools.Forms.NoMetadataNodeName" xml:space="preserve">
<value>No Metadata</value>
</data>
<data name="SharpDbTools.Forms.SetConnectionStringMenu" xml:space="preserve">
<value>Set Connection String</value>
</data>
<data name="SharpDbTools.Forms.LoadMetadataFromConnectionMenu" xml:space="preserve">
<value>Load Metadata From Connection</value>
</data>
<data name="SharpDbTools.Forms.LoadMetadataFromFileMenu" xml:space="preserve">
<value>Load Metadata From File</value>
</data>
<data name="SharpDbTools.Forms.OpenSQLToolMenu" xml:space="preserve">
<value>Open SQL Tool</value>
</data>
<data name="SharpDbTools.Forms.ConnectionStringNodeName" xml:space="preserve">
<value>Connection String:</value>
</data>
<data name="SharpDbTools.Forms.InvariantNameNodeName" xml:space="preserve">
<value>Invariant Name:</value>
</data>
<data name="SharpDbTools.Forms.ConnectionSucceededMsg" xml:space="preserve">
<value>Connection Succeeded</value>
</data>
<data name="SharpDbTools.Forms.ConnectionFailedMsg" xml:space="preserve">
<value>Connection Failed</value>
</data>
<data name="SharpDbTools.Forms.TestButton" xml:space="preserve">
<value>Test</value>
</data>
<data name="SharpDbTools.Forms.SubmitButton" xml:space="preserve">
<value>Submit</value>
</data>
<data name="SharpDbTools.Forms.CancelButton" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="SharpDbTools.Forms.DataSourceTypeLabel" xml:space="preserve">
<value>Data Source Type:</value>
</data>
<data name="SharpDbTools.Forms.ConnectionStringLabel" xml:space="preserve">
<value>Connection String:</value>
</data>
<data name="SharpDbTools.Forms.ConnectionStringTab" xml:space="preserve">
<value>Connection String</value>
</data>
<data name="SharpDbTools.Forms.TestResultTab" xml:space="preserve">
<value>Test Result Message</value>
</data>
<data name="SharpDbTools.Forms.ConnectionStringDefinitionDialog" xml:space="preserve">
<value>Set Up Connection String</value>
</data>
</root>

5
src/AddIns/Misc/SharpServerTools/SharpDbTools/Resources/SyntaxModes.xml

@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
<SyntaxModes version="1.0">
<Mode file = "SQL.xshd"
name = "SQL"
extensions = ".sql"/>
</SyntaxModes>

6
src/AddIns/Misc/SharpServerTools/SharpDbTools/SharpDbTools.sln

@ -1,6 +0,0 @@ @@ -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

20
src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Configuration/AssemblyInfo.cs

@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision: 1760 $</version>
// </file>
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("")]

109
src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms.TextEditor/SQLTextEditorControl.cs

@ -1,109 +0,0 @@ @@ -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
{
/// <summary>
/// Description of SQLTextEditorControl.
/// </summary>
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
{
/// <summary>
/// Testing at this stage, aiming to get some test data into a code completion window
/// </summary>
/// <param name="fileName"></param>
/// <param name="textArea"></param>
/// <param name="charTyped"></param>
/// <returns></returns>
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)
{
}
}
}

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

@ -1,186 +0,0 @@ @@ -1,186 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision$</version>
// </file>
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
{
/// <summary>
/// Description of DatabaseExplorerNode.
/// Hold minimal state - access state through the DbModelInfoService
/// </summary>
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;
/// <summary>
/// DatabaseExplorerTreeNode chucks away any existing Nodes and recreates its tree when it
/// is triggered.
/// </summary>
/// <param name="name"></param>
/// <returns></returns>
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);
}
/// <summary>
/// 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.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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<string> 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);
}
}
}
}
/// <summary>
/// If a DbModelInfoTreeNode is selected then the desired drag and drop behaviour
/// is to pass the ConnectionString to drop target.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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);
}
}
}
}

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

@ -1,305 +0,0 @@ @@ -1,305 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision$</version>
// </file>
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
{
/// <summary>
/// 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
/// </summary>
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;
}
/// <summary>
/// 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.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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<RunWorkerCompletedEventArgs>
(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);
}
}
}
}
}

52
src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/FormsArtefactFactories.cs

@ -1,52 +0,0 @@ @@ -1,52 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using ICSharpCode.Core;
namespace SharpDbTools.Forms
{
/// <summary>
/// Description of FormsArtefactFactories.
/// </summary>
public static class FormsArtefactFactories
{
public const string FORMS_ARTEFACT_FACTORIES_PATH = "/SharpServerTools/SharpDbTools/FormsArtefactFactory";
public static Dictionary<string, FormsArtefactFactory> factories = new Dictionary<string, FormsArtefactFactory>();
static FormsArtefactFactories()
{
AddInTreeNode node =
AddInTree.GetTreeNode(FORMS_ARTEFACT_FACTORIES_PATH);
List<Codon> 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;
}
}
}

32
src/AddIns/Misc/SharpServerTools/SharpDbTools/Src/Forms/FormsArtefactFactory.cs

@ -1,32 +0,0 @@ @@ -1,32 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Dickon Field" email=""/>
// <version>$Revision$</version>
// </file>
using System;
using System.Windows.Forms;
using ICSharpCode.Core;
namespace SharpDbTools.Forms
{
/// <summary>
/// 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.
/// </summary>
public abstract class FormsArtefactFactory
{
public FormsArtefactFactory()
{
}
public abstract TreeNode CreateMetaDataNode(string name);
public abstract string[] GetDescribeTableFieldNames();
public abstract string[] GetDescribeTableColumnHeaderNames();
}
}

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

@ -1,167 +0,0 @@ @@ -1,167 +0,0 @@
/*
* 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();
}
}
/// <summary>
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.
/// </summary>
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;
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save