Skip to content
This repository
Browse code

added VB to Demo (most code copied from old sample)

  • Loading branch information...
commit 28b37d274d1f362d8ee438f613fa27a522825b90 1 parent 9fef549
Siegfried Pammer authored
25  ICSharpCode.NRefactory.Demo/ICSharpCode.NRefactory.Demo.csproj
@@ -40,23 +40,48 @@
40 40
     <Reference Include="System.Xml" />
41 41
   </ItemGroup>
42 42
   <ItemGroup>
  43
+    <Compile Include="VBEditDialog.cs" />
  44
+    <Compile Include="VBEditDialog.Designer.cs">
  45
+      <DependentUpon>VBEditDialog.cs</DependentUpon>
  46
+    </Compile>
  47
+    <Compile Include="VBDomView.cs" />
  48
+    <Compile Include="VBDomView.Designer.cs">
  49
+      <DependentUpon>VBDomView.cs</DependentUpon>
  50
+    </Compile>
43 51
     <Compile Include="MainForm.cs" />
44 52
     <Compile Include="MainForm.Designer.cs">
45 53
       <DependentUpon>MainForm.cs</DependentUpon>
46 54
     </Compile>
47 55
     <Compile Include="Program.cs" />
48 56
     <Compile Include="Properties\AssemblyInfo.cs" />
  57
+    <Compile Include="VBDemo.cs" />
  58
+    <Compile Include="VBDemo.Designer.cs">
  59
+      <DependentUpon>VBDemo.cs</DependentUpon>
  60
+    </Compile>
49 61
   </ItemGroup>
50 62
   <ItemGroup>
  63
+    <ProjectReference Include="..\ICSharpCode.NRefactory.VB\ICSharpCode.NRefactory.VB.csproj">
  64
+      <Project>{7B82B671-419F-45F4-B778-D9286F996EFA}</Project>
  65
+      <Name>ICSharpCode.NRefactory.VB</Name>
  66
+    </ProjectReference>
51 67
     <ProjectReference Include="..\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj">
52 68
       <Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project>
53 69
       <Name>ICSharpCode.NRefactory</Name>
54 70
     </ProjectReference>
55 71
   </ItemGroup>
56 72
   <ItemGroup>
  73
+    <EmbeddedResource Include="VBEditDialog.resx">
  74
+      <DependentUpon>VBEditDialog.cs</DependentUpon>
  75
+    </EmbeddedResource>
  76
+    <EmbeddedResource Include="VBDomView.resx">
  77
+      <DependentUpon>VBDomView.cs</DependentUpon>
  78
+    </EmbeddedResource>
57 79
     <EmbeddedResource Include="MainForm.resx">
58 80
       <DependentUpon>MainForm.cs</DependentUpon>
59 81
     </EmbeddedResource>
  82
+    <EmbeddedResource Include="VBDemo.resx">
  83
+      <DependentUpon>VBDemo.cs</DependentUpon>
  84
+    </EmbeddedResource>
60 85
   </ItemGroup>
61 86
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
62 87
 </Project>
13  ICSharpCode.NRefactory.Demo/MainForm.Designer.cs
@@ -40,6 +40,8 @@ private void InitializeComponent()
40 40
 			this.csharpParseButton = new System.Windows.Forms.Button();
41 41
 			this.tabControl1 = new System.Windows.Forms.TabControl();
42 42
 			this.miniToolStrip = new System.Windows.Forms.ToolStrip();
  43
+			this.vbDemo1 = new ICSharpCode.NRefactory.Demo.VBDemo();
  44
+			this.tabPage2.SuspendLayout();
43 45
 			this.tabPage1.SuspendLayout();
44 46
 			((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
45 47
 			this.splitContainer1.Panel1.SuspendLayout();
@@ -50,6 +52,7 @@ private void InitializeComponent()
50 52
 			// 
51 53
 			// tabPage2
52 54
 			// 
  55
+			this.tabPage2.Controls.Add(this.vbDemo1);
53 56
 			this.tabPage2.Location = new System.Drawing.Point(4, 22);
54 57
 			this.tabPage2.Name = "tabPage2";
55 58
 			this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
@@ -177,6 +180,14 @@ private void InitializeComponent()
177 180
 			this.miniToolStrip.Size = new System.Drawing.Size(16, 25);
178 181
 			this.miniToolStrip.TabIndex = 3;
179 182
 			// 
  183
+			// vbDemo1
  184
+			// 
  185
+			this.vbDemo1.Dock = System.Windows.Forms.DockStyle.Fill;
  186
+			this.vbDemo1.Location = new System.Drawing.Point(3, 3);
  187
+			this.vbDemo1.Name = "vbDemo1";
  188
+			this.vbDemo1.Size = new System.Drawing.Size(501, 452);
  189
+			this.vbDemo1.TabIndex = 0;
  190
+			// 
180 191
 			// MainForm
181 192
 			// 
182 193
 			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -185,6 +196,7 @@ private void InitializeComponent()
185 196
 			this.Controls.Add(this.tabControl1);
186 197
 			this.Name = "MainForm";
187 198
 			this.Text = "NRefactory Demo";
  199
+			this.tabPage2.ResumeLayout(false);
188 200
 			this.tabPage1.ResumeLayout(false);
189 201
 			this.splitContainer1.Panel1.ResumeLayout(false);
190 202
 			this.splitContainer1.Panel1.PerformLayout();
@@ -194,6 +206,7 @@ private void InitializeComponent()
194 206
 			this.tabControl1.ResumeLayout(false);
195 207
 			this.ResumeLayout(false);
196 208
 		}
  209
+		private ICSharpCode.NRefactory.Demo.VBDemo vbDemo1;
197 210
 		private System.Windows.Forms.Button resolveButton;
198 211
 		private System.Windows.Forms.ToolStrip miniToolStrip;
199 212
 		private System.Windows.Forms.TreeView csharpTreeView;
163  ICSharpCode.NRefactory.Demo/VBDemo.Designer.cs
... ...
@@ -0,0 +1,163 @@
  1
+// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
  2
+// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
  3
+
  4
+namespace ICSharpCode.NRefactory.Demo
  5
+{
  6
+	partial class VBDemo
  7
+	{
  8
+		/// <summary>
  9
+		/// Designer variable used to keep track of non-visual components.
  10
+		/// </summary>
  11
+		private System.ComponentModel.IContainer components = null;
  12
+		
  13
+		/// <summary>
  14
+		/// Disposes resources used by the control.
  15
+		/// </summary>
  16
+		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  17
+		protected override void Dispose(bool disposing)
  18
+		{
  19
+			if (disposing) {
  20
+				if (components != null) {
  21
+					components.Dispose();
  22
+				}
  23
+			}
  24
+			base.Dispose(disposing);
  25
+		}
  26
+		
  27
+		/// <summary>
  28
+		/// This method is required for Windows Forms designer support.
  29
+		/// Do not change the method contents inside the source code editor. The Forms designer might
  30
+		/// not be able to load this method if it was changed manually.
  31
+		/// </summary>
  32
+		private void InitializeComponent()
  33
+		{
  34
+			this.splitContainer1 = new System.Windows.Forms.SplitContainer();
  35
+			this.codeView = new System.Windows.Forms.TextBox();
  36
+			this.editNodeButton = new System.Windows.Forms.Button();
  37
+			this.clearSpecialsButton = new System.Windows.Forms.Button();
  38
+			this.syntaxTree = new ICSharpCode.NRefactory.Demo.VBDomView();
  39
+			this.generateCodeButton = new System.Windows.Forms.Button();
  40
+			this.parseButton = new System.Windows.Forms.Button();
  41
+			((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
  42
+			this.splitContainer1.Panel1.SuspendLayout();
  43
+			this.splitContainer1.Panel2.SuspendLayout();
  44
+			this.splitContainer1.SuspendLayout();
  45
+			this.SuspendLayout();
  46
+			// 
  47
+			// splitContainer1
  48
+			// 
  49
+			this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
  50
+			this.splitContainer1.Location = new System.Drawing.Point(0, 0);
  51
+			this.splitContainer1.Name = "splitContainer1";
  52
+			this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
  53
+			// 
  54
+			// splitContainer1.Panel1
  55
+			// 
  56
+			this.splitContainer1.Panel1.Controls.Add(this.codeView);
  57
+			// 
  58
+			// splitContainer1.Panel2
  59
+			// 
  60
+			this.splitContainer1.Panel2.Controls.Add(this.editNodeButton);
  61
+			this.splitContainer1.Panel2.Controls.Add(this.clearSpecialsButton);
  62
+			this.splitContainer1.Panel2.Controls.Add(this.syntaxTree);
  63
+			this.splitContainer1.Panel2.Controls.Add(this.generateCodeButton);
  64
+			this.splitContainer1.Panel2.Controls.Add(this.parseButton);
  65
+			this.splitContainer1.Size = new System.Drawing.Size(462, 391);
  66
+			this.splitContainer1.SplitterDistance = 173;
  67
+			this.splitContainer1.TabIndex = 1;
  68
+			// 
  69
+			// codeView
  70
+			// 
  71
+			this.codeView.AcceptsReturn = true;
  72
+			this.codeView.AcceptsTab = true;
  73
+			this.codeView.Dock = System.Windows.Forms.DockStyle.Fill;
  74
+			this.codeView.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
  75
+			this.codeView.HideSelection = false;
  76
+			this.codeView.Location = new System.Drawing.Point(0, 0);
  77
+			this.codeView.Multiline = true;
  78
+			this.codeView.Name = "codeView";
  79
+			this.codeView.ScrollBars = System.Windows.Forms.ScrollBars.Both;
  80
+			this.codeView.Size = new System.Drawing.Size(462, 173);
  81
+			this.codeView.TabIndex = 0;
  82
+			this.codeView.Text = "Imports System\r\nClass Test\r\n    Public Sub Main(ByVal args As String())\r\n        " +
  83
+			" Console.WriteLine(\"Hello, World\")\r\n    End Sub\r\nEnd Class";
  84
+			this.codeView.WordWrap = false;
  85
+			// 
  86
+			// editNodeButton
  87
+			// 
  88
+			this.editNodeButton.Anchor = System.Windows.Forms.AnchorStyles.Top;
  89
+			this.editNodeButton.Location = new System.Drawing.Point(331, 2);
  90
+			this.editNodeButton.Name = "editNodeButton";
  91
+			this.editNodeButton.Size = new System.Drawing.Size(100, 23);
  92
+			this.editNodeButton.TabIndex = 4;
  93
+			this.editNodeButton.Text = "Edit node";
  94
+			this.editNodeButton.UseVisualStyleBackColor = true;
  95
+			this.editNodeButton.Click += new System.EventHandler(this.EditNodeButtonClick);
  96
+			// 
  97
+			// clearSpecialsButton
  98
+			// 
  99
+			this.clearSpecialsButton.Anchor = System.Windows.Forms.AnchorStyles.Top;
  100
+			this.clearSpecialsButton.Location = new System.Drawing.Point(225, 2);
  101
+			this.clearSpecialsButton.Name = "clearSpecialsButton";
  102
+			this.clearSpecialsButton.Size = new System.Drawing.Size(100, 23);
  103
+			this.clearSpecialsButton.TabIndex = 3;
  104
+			this.clearSpecialsButton.Text = "Clear 0 specials";
  105
+			this.clearSpecialsButton.UseVisualStyleBackColor = true;
  106
+			this.clearSpecialsButton.Click += new System.EventHandler(this.ClearSpecialsButtonClick);
  107
+			// 
  108
+			// syntaxTree
  109
+			// 
  110
+			this.syntaxTree.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
  111
+									| System.Windows.Forms.AnchorStyles.Left) 
  112
+									| System.Windows.Forms.AnchorStyles.Right)));
  113
+			this.syntaxTree.Location = new System.Drawing.Point(3, 32);
  114
+			this.syntaxTree.Name = "syntaxTree";
  115
+			this.syntaxTree.Size = new System.Drawing.Size(459, 182);
  116
+			this.syntaxTree.TabIndex = 2;
  117
+			this.syntaxTree.Unit = null;
  118
+			// 
  119
+			// generateCodeButton
  120
+			// 
  121
+			this.generateCodeButton.Anchor = System.Windows.Forms.AnchorStyles.Top;
  122
+			this.generateCodeButton.Location = new System.Drawing.Point(119, 2);
  123
+			this.generateCodeButton.Name = "generateCodeButton";
  124
+			this.generateCodeButton.Size = new System.Drawing.Size(100, 23);
  125
+			this.generateCodeButton.TabIndex = 1;
  126
+			this.generateCodeButton.Text = "Generate";
  127
+			this.generateCodeButton.UseVisualStyleBackColor = true;
  128
+			this.generateCodeButton.Click += new System.EventHandler(this.GenerateCodeButtonClick);
  129
+			// 
  130
+			// parseButton
  131
+			// 
  132
+			this.parseButton.Anchor = System.Windows.Forms.AnchorStyles.Top;
  133
+			this.parseButton.Location = new System.Drawing.Point(13, 2);
  134
+			this.parseButton.Name = "parseButton";
  135
+			this.parseButton.Size = new System.Drawing.Size(100, 23);
  136
+			this.parseButton.TabIndex = 0;
  137
+			this.parseButton.Text = "Parse";
  138
+			this.parseButton.UseVisualStyleBackColor = true;
  139
+			this.parseButton.Click += new System.EventHandler(this.ParseButtonClick);
  140
+			// 
  141
+			// VBDemo
  142
+			// 
  143
+			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
  144
+			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  145
+			this.Controls.Add(this.splitContainer1);
  146
+			this.Name = "VBDemo";
  147
+			this.Size = new System.Drawing.Size(462, 391);
  148
+			this.splitContainer1.Panel1.ResumeLayout(false);
  149
+			this.splitContainer1.Panel1.PerformLayout();
  150
+			this.splitContainer1.Panel2.ResumeLayout(false);
  151
+			((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
  152
+			this.splitContainer1.ResumeLayout(false);
  153
+			this.ResumeLayout(false);
  154
+		}
  155
+		private System.Windows.Forms.Button clearSpecialsButton;
  156
+		private System.Windows.Forms.Button editNodeButton;
  157
+		private ICSharpCode.NRefactory.Demo.VBDomView syntaxTree;
  158
+		private System.Windows.Forms.TextBox codeView;
  159
+		private System.Windows.Forms.Button generateCodeButton;
  160
+		private System.Windows.Forms.Button parseButton;
  161
+		private System.Windows.Forms.SplitContainer splitContainer1;
  162
+	}
  163
+}
78  ICSharpCode.NRefactory.Demo/VBDemo.cs
... ...
@@ -0,0 +1,78 @@
  1
+// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
  2
+// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
  3
+
  4
+using System;
  5
+using System.Collections.Generic;
  6
+using System.ComponentModel;
  7
+using System.Drawing;
  8
+using System.IO;
  9
+using System.Linq;
  10
+using System.Windows.Forms;
  11
+using ICSharpCode.NRefactory.VB;
  12
+using ICSharpCode.NRefactory.VB.Parser;
  13
+using ICSharpCode.NRefactory.VB.PrettyPrinter;
  14
+
  15
+namespace ICSharpCode.NRefactory.Demo
  16
+{
  17
+	/// <summary>
  18
+	/// Description of VBDemo.
  19
+	/// </summary>
  20
+	public partial class VBDemo : UserControl
  21
+	{
  22
+		public VBDemo()
  23
+		{
  24
+			//
  25
+			// The InitializeComponent() call is required for Windows Forms designer support.
  26
+			//
  27
+			InitializeComponent();
  28
+			ParseButtonClick(null, null);
  29
+		}
  30
+		
  31
+		IList<ISpecial> savedSpecials;
  32
+		
  33
+		void ParseButtonClick(object sender, EventArgs e)
  34
+		{
  35
+			using (VBParser parser = new VBParser(new VBLexer(new StringReader(codeView.Text)))) {
  36
+				parser.Parse();
  37
+				// this allows retrieving comments, preprocessor directives, etc. (stuff that isn't part of the syntax)
  38
+				SetSpecials(parser.Lexer.SpecialTracker.RetrieveSpecials());
  39
+				// this retrieves the root node of the result DOM
  40
+				if (parser.Errors.Count > 0) {
  41
+					MessageBox.Show(parser.Errors.ErrorOutput);
  42
+				}
  43
+				syntaxTree.Unit = parser.CompilationUnit;
  44
+			}
  45
+		}
  46
+		
  47
+		void GenerateCodeButtonClick(object sender, EventArgs e)
  48
+		{
  49
+			if (syntaxTree.Unit != null) {
  50
+				VBNetOutputVisitor visitor = new VBNetOutputVisitor();
  51
+				// re-insert the comments we saved from the parser into the output
  52
+				using (SpecialNodesInserter.Install(savedSpecials, visitor)) {
  53
+					syntaxTree.Unit.AcceptVisitor(visitor, null);
  54
+				}
  55
+				codeView.Text = visitor.Text.Replace("\t", "  ");
  56
+			}
  57
+		}
  58
+		
  59
+		void ClearSpecialsButtonClick(object sender, EventArgs e)
  60
+		{
  61
+			SetSpecials(new ISpecial[0]);
  62
+		}
  63
+		
  64
+		void EditNodeButtonClick(object sender, EventArgs e)
  65
+		{
  66
+			syntaxTree.EditSelectedNode();
  67
+		}
  68
+		
  69
+		void SetSpecials(IList<ISpecial> specials)
  70
+		{
  71
+			savedSpecials = specials;
  72
+			if (specials.Count == 1)
  73
+				clearSpecialsButton.Text = "Clear 1 special";
  74
+			else
  75
+				clearSpecialsButton.Text = "Clear " + specials.Count + " specials";
  76
+		}
  77
+	}
  78
+}
120  ICSharpCode.NRefactory.Demo/VBDemo.resx
... ...
@@ -0,0 +1,120 @@
  1
+<?xml version="1.0" encoding="utf-8"?>
  2
+<root>
  3
+  <!-- 
  4
+    Microsoft ResX Schema 
  5
+    
  6
+    Version 2.0
  7
+    
  8
+    The primary goals of this format is to allow a simple XML format 
  9
+    that is mostly human readable. The generation and parsing of the 
  10
+    various data types are done through the TypeConverter classes 
  11
+    associated with the data types.
  12
+    
  13
+    Example:
  14
+    
  15
+    ... ado.net/XML headers & schema ...
  16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
  17
+    <resheader name="version">2.0</resheader>
  18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
  19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
  20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
  21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
  22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
  23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
  24
+    </data>
  25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
  26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
  27
+        <comment>This is a comment</comment>
  28
+    </data>
  29
+                
  30
+    There are any number of "resheader" rows that contain simple 
  31
+    name/value pairs.
  32
+    
  33
+    Each data row contains a name, and value. The row also contains a 
  34
+    type or mimetype. Type corresponds to a .NET class that support 
  35
+    text/value conversion through the TypeConverter architecture. 
  36
+    Classes that don't support this are serialized and stored with the 
  37
+    mimetype set.
  38
+    
  39
+    The mimetype is used for serialized objects, and tells the 
  40
+    ResXResourceReader how to depersist the object. This is currently not 
  41
+    extensible. For a given mimetype the value must be set accordingly:
  42
+    
  43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
  44
+    that the ResXResourceWriter will generate, however the reader can 
  45
+    read any of the formats listed below.
  46
+    
  47
+    mimetype: application/x-microsoft.net.object.binary.base64
  48
+    value   : The object must be serialized with 
  49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
  50
+            : and then encoded with base64 encoding.
  51
+    
  52
+    mimetype: application/x-microsoft.net.object.soap.base64
  53
+    value   : The object must be serialized with 
  54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
  55
+            : and then encoded with base64 encoding.
  56
+
  57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
  58
+    value   : The object must be serialized into a byte array 
  59
+            : using a System.ComponentModel.TypeConverter
  60
+            : and then encoded with base64 encoding.
  61
+    -->
  62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
  64
+    <xsd:element name="root" msdata:IsDataSet="true">
  65
+      <xsd:complexType>
  66
+        <xsd:choice maxOccurs="unbounded">
  67
+          <xsd:element name="metadata">
  68
+            <xsd:complexType>
  69
+              <xsd:sequence>
  70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
  71
+              </xsd:sequence>
  72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
  73
+              <xsd:attribute name="type" type="xsd:string" />
  74
+              <xsd:attribute name="mimetype" type="xsd:string" />
  75
+              <xsd:attribute ref="xml:space" />
  76
+            </xsd:complexType>
  77
+          </xsd:element>
  78
+          <xsd:element name="assembly">
  79
+            <xsd:complexType>
  80
+              <xsd:attribute name="alias" type="xsd:string" />
  81
+              <xsd:attribute name="name" type="xsd:string" />
  82
+            </xsd:complexType>
  83
+          </xsd:element>
  84
+          <xsd:element name="data">
  85
+            <xsd:complexType>
  86
+              <xsd:sequence>
  87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
  88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
  89
+              </xsd:sequence>
  90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
  91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
  92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
  93
+              <xsd:attribute ref="xml:space" />
  94
+            </xsd:complexType>
  95
+          </xsd:element>
  96
+          <xsd:element name="resheader">
  97
+            <xsd:complexType>
  98
+              <xsd:sequence>
  99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
  100
+              </xsd:sequence>
  101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
  102
+            </xsd:complexType>
  103
+          </xsd:element>
  104
+        </xsd:choice>
  105
+      </xsd:complexType>
  106
+    </xsd:element>
  107
+  </xsd:schema>
  108
+  <resheader name="resmimetype">
  109
+    <value>text/microsoft-resx</value>
  110
+  </resheader>
  111
+  <resheader name="version">
  112
+    <value>2.0</value>
  113
+  </resheader>
  114
+  <resheader name="reader">
  115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  116
+  </resheader>
  117
+  <resheader name="writer">
  118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  119
+  </resheader>
  120
+</root>
83  ICSharpCode.NRefactory.Demo/VBDomView.Designer.cs
... ...
@@ -0,0 +1,83 @@
  1
+// SharpDevelop samples
  2
+// Copyright (c) 2006, AlphaSierraPapa
  3
+// All rights reserved.
  4
+//
  5
+// Redistribution and use in source and binary forms, with or without modification, are
  6
+// permitted provided that the following conditions are met:
  7
+//
  8
+// - Redistributions of source code must retain the above copyright notice, this list
  9
+//   of conditions and the following disclaimer.
  10
+//
  11
+// - Redistributions in binary form must reproduce the above copyright notice, this list
  12
+//   of conditions and the following disclaimer in the documentation and/or other materials
  13
+//   provided with the distribution.
  14
+//
  15
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
  16
+//   endorse or promote products derived from this software without specific prior written
  17
+//   permission.
  18
+//
  19
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
  20
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  21
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  22
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  24
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  25
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  26
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27
+
  28
+namespace ICSharpCode.NRefactory.Demo
  29
+{
  30
+	partial class VBDomView : System.Windows.Forms.UserControl
  31
+	{
  32
+		/// <summary>
  33
+		/// Designer variable used to keep track of non-visual components.
  34
+		/// </summary>
  35
+		private System.ComponentModel.IContainer components = null;
  36
+		
  37
+		/// <summary>
  38
+		/// Disposes resources used by the control.
  39
+		/// </summary>
  40
+		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  41
+		protected override void Dispose(bool disposing)
  42
+		{
  43
+			if (disposing) {
  44
+				if (components != null) {
  45
+					components.Dispose();
  46
+				}
  47
+			}
  48
+			base.Dispose(disposing);
  49
+		}
  50
+		
  51
+		/// <summary>
  52
+		/// This method is required for Windows Forms designer support.
  53
+		/// Do not change the method contents inside the source code editor. The Forms designer might
  54
+		/// not be able to load this method if it was changed manually.
  55
+		/// </summary>
  56
+		private void InitializeComponent()
  57
+		{
  58
+			this.tree = new System.Windows.Forms.TreeView();
  59
+			this.SuspendLayout();
  60
+			// 
  61
+			// tree
  62
+			// 
  63
+			this.tree.Dock = System.Windows.Forms.DockStyle.Fill;
  64
+			this.tree.HideSelection = false;
  65
+			this.tree.Location = new System.Drawing.Point(0, 0);
  66
+			this.tree.Name = "tree";
  67
+			this.tree.ShowRootLines = false;
  68
+			this.tree.Size = new System.Drawing.Size(186, 182);
  69
+			this.tree.TabIndex = 0;
  70
+			this.tree.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TreeKeyDown);
  71
+			// 
  72
+			// AstView
  73
+			// 
  74
+			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
  75
+			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  76
+			this.Controls.Add(this.tree);
  77
+			this.Name = "AstView";
  78
+			this.Size = new System.Drawing.Size(186, 182);
  79
+			this.ResumeLayout(false);
  80
+		}
  81
+		private System.Windows.Forms.TreeView tree;
  82
+	}
  83
+}
249  ICSharpCode.NRefactory.Demo/VBDomView.cs
... ...
@@ -0,0 +1,249 @@
  1
+// SharpDevelop samples
  2
+// Copyright (c) 2006, AlphaSierraPapa
  3
+// All rights reserved.
  4
+//
  5
+// Redistribution and use in source and binary forms, with or without modification, are
  6
+// permitted provided that the following conditions are met:
  7
+//
  8
+// - Redistributions of source code must retain the above copyright notice, this list
  9
+//   of conditions and the following disclaimer.
  10
+//
  11
+// - Redistributions in binary form must reproduce the above copyright notice, this list
  12
+//   of conditions and the following disclaimer in the documentation and/or other materials
  13
+//   provided with the distribution.
  14
+//
  15
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
  16
+//   endorse or promote products derived from this software without specific prior written
  17
+//   permission.
  18
+//
  19
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
  20
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  21
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  22
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  24
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  25
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  26
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27
+
  28
+using System;
  29
+using System.Collections;
  30
+using System.Windows.Forms;
  31
+using System.Reflection;
  32
+
  33
+using ICSharpCode.NRefactory.VB.Dom;
  34
+using ICSharpCode.NRefactory.VB;
  35
+
  36
+namespace ICSharpCode.NRefactory.Demo
  37
+{
  38
+	public partial class VBDomView
  39
+	{
  40
+		CompilationUnit unit;
  41
+		
  42
+		public CompilationUnit Unit {
  43
+			get {
  44
+				return unit;
  45
+			}
  46
+			set {
  47
+				if (value != null) {
  48
+					unit = value;
  49
+					UpdateTree();
  50
+				}
  51
+			}
  52
+		}
  53
+		
  54
+		void UpdateTree()
  55
+		{
  56
+			tree.Nodes.Clear();
  57
+			tree.Nodes.Add(new CollectionNode("CompilationUnit", unit.Children));
  58
+			tree.SelectedNode = tree.Nodes[0];
  59
+		}
  60
+		
  61
+		public VBDomView()
  62
+		{
  63
+			InitializeComponent();
  64
+		}
  65
+		
  66
+		public void DeleteSelectedNode()
  67
+		{
  68
+			if (tree.SelectedNode is ElementNode) {
  69
+				INode element = (tree.SelectedNode as ElementNode).element;
  70
+				if (tree.SelectedNode.Parent is CollectionNode) {
  71
+					if (MessageBox.Show("Remove selected node from parent collection?", "Remove node", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
  72
+					    == DialogResult.Yes)
  73
+					{
  74
+						IList col = (tree.SelectedNode.Parent as CollectionNode).collection;
  75
+						col.Remove(element);
  76
+						(tree.SelectedNode.Parent as CollectionNode).Update();
  77
+					}
  78
+				} else if (tree.SelectedNode.Parent is ElementNode) {
  79
+					if (MessageBox.Show("Set selected property to null?", "Remove node", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
  80
+					    == DialogResult.Yes)
  81
+					{
  82
+						// get parent element
  83
+						element = (tree.SelectedNode.Parent as ElementNode).element;
  84
+						string propertyName = (string)tree.SelectedNode.Tag;
  85
+						element.GetType().GetProperty(propertyName).SetValue(element, null, null);
  86
+						(tree.SelectedNode.Parent as ElementNode).Update();
  87
+					}
  88
+				}
  89
+			} else if (tree.SelectedNode is CollectionNode) {
  90
+				if (MessageBox.Show("Remove all elements from selected collection?", "Clear collection", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
  91
+				    == DialogResult.Yes)
  92
+				{
  93
+					IList col = (tree.SelectedNode as CollectionNode).collection;
  94
+					col.Clear();
  95
+					(tree.SelectedNode as CollectionNode).Update();
  96
+				}
  97
+			}
  98
+		}
  99
+		
  100
+		public void EditSelectedNode()
  101
+		{
  102
+			TreeNode node = tree.SelectedNode;
  103
+			while (!(node is ElementNode)) {
  104
+				if (node == null) {
  105
+					return;
  106
+				}
  107
+				node = node.Parent;
  108
+			}
  109
+			INode element = ((ElementNode)node).element;
  110
+			using (VBEditDialog dlg = new VBEditDialog(element)) {
  111
+				dlg.ShowDialog();
  112
+			}
  113
+			((ElementNode)node).Update();
  114
+		}
  115
+		
  116
+		public void ApplyTransformation(IDomVisitor visitor)
  117
+		{
  118
+			if (tree.SelectedNode == tree.Nodes[0]) {
  119
+				unit.AcceptVisitor(visitor, null);
  120
+				UpdateTree();
  121
+			} else {
  122
+				string name = visitor.GetType().Name;
  123
+				ElementNode elementNode = tree.SelectedNode as ElementNode;
  124
+				CollectionNode collectionNode = tree.SelectedNode as CollectionNode;
  125
+				if (elementNode != null) {
  126
+					if (MessageBox.Show(("Apply " + name + " to selected element '" + elementNode.Text + "'?"),
  127
+					                    "Apply transformation", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
  128
+					    == DialogResult.Yes)
  129
+					{
  130
+						elementNode.element.AcceptVisitor(visitor, null);
  131
+						elementNode.Update();
  132
+					}
  133
+				} else if (collectionNode != null) {
  134
+					if (MessageBox.Show(("Apply " + name + " to all elements in selected collection '" + collectionNode.Text + "'?"),
  135
+					                    "Apply transformation", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
  136
+					    == DialogResult.Yes)
  137
+					{
  138
+						foreach (TreeNode subNode in collectionNode.Nodes) {
  139
+							if (subNode is ElementNode) {
  140
+								(subNode as ElementNode).element.AcceptVisitor(visitor, null);
  141
+							}
  142
+						}
  143
+						collectionNode.Update();
  144
+					}
  145
+				}
  146
+			}
  147
+		}
  148
+		
  149
+		static TreeNode CreateNode(object child)
  150
+		{
  151
+			if (child == null) {
  152
+				return new TreeNode("*null reference*");
  153
+			} else if (child is INode) {
  154
+				return new ElementNode(child as INode);
  155
+			} else {
  156
+				return new TreeNode(child.ToString());
  157
+			}
  158
+		}
  159
+		
  160
+		class CollectionNode : TreeNode
  161
+		{
  162
+			internal IList collection;
  163
+			string baseName;
  164
+			
  165
+			public CollectionNode(string text, IList children) : base(text)
  166
+			{
  167
+				this.baseName = text;
  168
+				this.collection = children;
  169
+				Update();
  170
+			}
  171
+			
  172
+			public void Update()
  173
+			{
  174
+				if (collection.Count == 0) {
  175
+					Text = baseName + " (empty collection)";
  176
+				} else if (collection.Count == 1) {
  177
+					Text = baseName + " (collection with 1 element)";
  178
+				} else {
  179
+					Text = baseName + " (collection with " + collection.Count + " elements)";
  180
+				}
  181
+				Nodes.Clear();
  182
+				foreach (object child in collection) {
  183
+					Nodes.Add(CreateNode(child));
  184
+				}
  185
+				Expand();
  186
+			}
  187
+		}
  188
+		
  189
+		class ElementNode : TreeNode
  190
+		{
  191
+			internal INode element;
  192
+			
  193
+			public ElementNode(INode node)
  194
+			{
  195
+				this.element = node;
  196
+				Update();
  197
+			}
  198
+			
  199
+			public void Update()
  200
+			{
  201
+				Nodes.Clear();
  202
+				Type type = element.GetType();
  203
+				Text = type.Name;
  204
+				if (Tag != null) { // HACK: after editing property element
  205
+					Text = Tag.ToString() + " = " + Text;
  206
+				}
  207
+				if (!(element is INullable && (element as INullable).IsNull)) {
  208
+					AddProperties(type, element);
  209
+					if (element.Children.Count > 0) {
  210
+						Nodes.Add(new CollectionNode("Children", element.Children));
  211
+					}
  212
+				}
  213
+			}
  214
+			
  215
+			void AddProperties(Type type, INode node)
  216
+			{
  217
+				if (type == typeof(AbstractNode))
  218
+					return;
  219
+				foreach (PropertyInfo pi in type.GetProperties(BindingFlags.Instance | BindingFlags.Public)) {
  220
+					if (pi.DeclaringType != type) // don't add derived properties
  221
+						continue;
  222
+					if (pi.Name == "IsNull")
  223
+						continue;
  224
+					object value = pi.GetValue(node, null);
  225
+					if (value is IList) {
  226
+						Nodes.Add(new CollectionNode(pi.Name, (IList)value));
  227
+					} else if (value is string) {
  228
+						Text += " " + pi.Name + "='" + value + "'";
  229
+					} else {
  230
+						TreeNode treeNode = CreateNode(value);
  231
+						treeNode.Text = pi.Name + " = " + treeNode.Text;
  232
+						treeNode.Tag = pi.Name;
  233
+						Nodes.Add(treeNode);
  234
+					}
  235
+				}
  236
+				AddProperties(type.BaseType, node);
  237
+			}
  238
+		}
  239
+		
  240
+		void TreeKeyDown(object sender, KeyEventArgs e)
  241
+		{
  242
+			if (e.KeyData == Keys.Delete) {
  243
+				DeleteSelectedNode();
  244
+			} else if (e.KeyData == Keys.Space || e.KeyData == Keys.Enter) {
  245
+				EditSelectedNode();
  246
+			}
  247
+		}
  248
+	}
  249
+}
120  ICSharpCode.NRefactory.Demo/VBDomView.resx
... ...
@@ -0,0 +1,120 @@
  1
+<?xml version="1.0" encoding="utf-8"?>
  2
+<root>
  3
+  <!-- 
  4
+    Microsoft ResX Schema 
  5
+    
  6
+    Version 2.0
  7
+    
  8
+    The primary goals of this format is to allow a simple XML format 
  9
+    that is mostly human readable. The generation and parsing of the 
  10
+    various data types are done through the TypeConverter classes 
  11
+    associated with the data types.
  12
+    
  13
+    Example:
  14
+    
  15
+    ... ado.net/XML headers & schema ...
  16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
  17
+    <resheader name="version">2.0</resheader>
  18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
  19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
  20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
  21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
  22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
  23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
  24
+    </data>
  25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
  26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
  27
+        <comment>This is a comment</comment>
  28
+    </data>
  29
+                
  30
+    There are any number of "resheader" rows that contain simple 
  31
+    name/value pairs.
  32
+    
  33
+    Each data row contains a name, and value. The row also contains a 
  34
+    type or mimetype. Type corresponds to a .NET class that support 
  35
+    text/value conversion through the TypeConverter architecture. 
  36
+    Classes that don't support this are serialized and stored with the 
  37
+    mimetype set.
  38
+    
  39
+    The mimetype is used for serialized objects, and tells the 
  40
+    ResXResourceReader how to depersist the object. This is currently not 
  41
+    extensible. For a given mimetype the value must be set accordingly:
  42
+    
  43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
  44
+    that the ResXResourceWriter will generate, however the reader can 
  45
+    read any of the formats listed below.
  46
+    
  47
+    mimetype: application/x-microsoft.net.object.binary.base64
  48
+    value   : The object must be serialized with 
  49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
  50
+            : and then encoded with base64 encoding.
  51
+    
  52
+    mimetype: application/x-microsoft.net.object.soap.base64
  53
+    value   : The object must be serialized with 
  54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
  55
+            : and then encoded with base64 encoding.
  56
+
  57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
  58
+    value   : The object must be serialized into a byte array 
  59
+            : using a System.ComponentModel.TypeConverter
  60
+            : and then encoded with base64 encoding.
  61
+    -->
  62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
  64
+    <xsd:element name="root" msdata:IsDataSet="true">
  65
+      <xsd:complexType>
  66
+        <xsd:choice maxOccurs="unbounded">
  67
+          <xsd:element name="metadata">
  68
+            <xsd:complexType>
  69
+              <xsd:sequence>
  70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
  71
+              </xsd:sequence>
  72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
  73
+              <xsd:attribute name="type" type="xsd:string" />
  74
+              <xsd:attribute name="mimetype" type="xsd:string" />
  75
+              <xsd:attribute ref="xml:space" />
  76
+            </xsd:complexType>
  77
+          </xsd:element>
  78
+          <xsd:element name="assembly">
  79
+            <xsd:complexType>
  80
+              <xsd:attribute name="alias" type="xsd:string" />
  81
+              <xsd:attribute name="name" type="xsd:string" />
  82
+            </xsd:complexType>
  83
+          </xsd:element>
  84
+          <xsd:element name="data">
  85
+            <xsd:complexType>
  86
+              <xsd:sequence>
  87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
  88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
  89
+              </xsd:sequence>
  90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
  91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
  92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
  93
+              <xsd:attribute ref="xml:space" />
  94
+            </xsd:complexType>
  95
+          </xsd:element>
  96
+          <xsd:element name="resheader">
  97
+            <xsd:complexType>
  98
+              <xsd:sequence>
  99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
  100
+              </xsd:sequence>
  101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
  102
+            </xsd:complexType>
  103
+          </xsd:element>
  104
+        </xsd:choice>
  105
+      </xsd:complexType>
  106
+    </xsd:element>
  107
+  </xsd:schema>
  108
+  <resheader name="resmimetype">
  109
+    <value>text/microsoft-resx</value>
  110
+  </resheader>
  111
+  <resheader name="version">
  112
+    <value>2.0</value>
  113
+  </resheader>
  114
+  <resheader name="reader">
  115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  116
+  </resheader>
  117
+  <resheader name="writer">
  118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  119
+  </resheader>
  120
+</root>
112  ICSharpCode.NRefactory.Demo/VBEditDialog.Designer.cs
... ...
@@ -0,0 +1,112 @@
  1
+// SharpDevelop samples
  2
+// Copyright (c) 2006, AlphaSierraPapa
  3
+// All rights reserved.
  4
+//
  5
+// Redistribution and use in source and binary forms, with or without modification, are
  6
+// permitted provided that the following conditions are met:
  7
+//
  8
+// - Redistributions of source code must retain the above copyright notice, this list
  9
+//   of conditions and the following disclaimer.
  10
+//
  11
+// - Redistributions in binary form must reproduce the above copyright notice, this list
  12
+//   of conditions and the following disclaimer in the documentation and/or other materials
  13
+//   provided with the distribution.
  14
+//
  15
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
  16
+//   endorse or promote products derived from this software without specific prior written
  17
+//   permission.
  18
+//
  19
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
  20
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  21
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  22
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  24
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  25
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  26
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27
+
  28
+namespace ICSharpCode.NRefactory.Demo
  29
+{
  30
+	partial class VBEditDialog : System.Windows.Forms.Form
  31
+	{
  32
+		/// <summary>
  33
+		/// Designer variable used to keep track of non-visual components.
  34
+		/// </summary>
  35
+		private System.ComponentModel.IContainer components = null;
  36
+		
  37
+		/// <summary>
  38
+		/// Disposes resources used by the form.
  39
+		/// </summary>
  40
+		/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  41
+		protected override void Dispose(bool disposing)
  42
+		{
  43
+			if (disposing) {
  44
+				if (components != null) {
  45
+					components.Dispose();
  46
+				}
  47
+			}
  48
+			base.Dispose(disposing);
  49
+		}
  50
+		
  51
+		/// <summary>
  52
+		/// This method is required for Windows Forms designer support.
  53
+		/// Do not change the method contents inside the source code editor. The Forms designer might
  54
+		/// not be able to load this method if it was changed manually.
  55
+		/// </summary>
  56
+		private void InitializeComponent()
  57
+		{
  58
+			this.propertyGrid = new System.Windows.Forms.PropertyGrid();
  59
+			this.panel1 = new System.Windows.Forms.Panel();
  60
+			this.okButton = new System.Windows.Forms.Button();
  61
+			this.panel1.SuspendLayout();
  62
+			this.SuspendLayout();
  63
+			// 
  64
+			// propertyGrid
  65
+			// 
  66
+			this.propertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
  67
+			this.propertyGrid.HelpVisible = false;
  68
+			this.propertyGrid.Location = new System.Drawing.Point(0, 0);
  69
+			this.propertyGrid.Name = "propertyGrid";
  70
+			this.propertyGrid.PropertySort = System.Windows.Forms.PropertySort.Alphabetical;
  71
+			this.propertyGrid.Size = new System.Drawing.Size(477, 436);
  72
+			this.propertyGrid.TabIndex = 0;
  73
+			this.propertyGrid.ToolbarVisible = false;
  74
+			// 
  75
+			// panel1
  76
+			// 
  77
+			this.panel1.Controls.Add(this.okButton);
  78
+			this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
  79
+			this.panel1.Location = new System.Drawing.Point(0, 436);
  80
+			this.panel1.Name = "panel1";
  81
+			this.panel1.Size = new System.Drawing.Size(477, 38);
  82
+			this.panel1.TabIndex = 1;
  83
+			// 
  84
+			// okButton
  85
+			// 
  86
+			this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
  87
+			this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
  88
+			this.okButton.Location = new System.Drawing.Point(390, 6);
  89
+			this.okButton.Name = "okButton";
  90
+			this.okButton.Size = new System.Drawing.Size(75, 23);
  91
+			this.okButton.TabIndex = 0;
  92
+			this.okButton.Text = "OK";
  93
+			this.okButton.UseVisualStyleBackColor = true;
  94
+			// 
  95
+			// EditDialog
  96
+			// 
  97
+			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
  98
+			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  99
+			this.CancelButton = this.okButton;
  100
+			this.ClientSize = new System.Drawing.Size(477, 474);
  101
+			this.Controls.Add(this.propertyGrid);
  102
+			this.Controls.Add(this.panel1);
  103
+			this.Name = "EditDialog";
  104
+			this.Text = "EditDialog";
  105
+			this.panel1.ResumeLayout(false);
  106
+			this.ResumeLayout(false);
  107
+		}
  108
+		private System.Windows.Forms.PropertyGrid propertyGrid;
  109
+		private System.Windows.Forms.Button okButton;
  110
+		private System.Windows.Forms.Panel panel1;
  111
+	}
  112
+}
42  ICSharpCode.NRefactory.Demo/VBEditDialog.cs
... ...
@@ -0,0 +1,42 @@
  1
+// SharpDevelop samples
  2
+// Copyright (c) 2006, AlphaSierraPapa
  3
+// All rights reserved.
  4
+//
  5
+// Redistribution and use in source and binary forms, with or without modification, are
  6
+// permitted provided that the following conditions are met:
  7
+//
  8
+// - Redistributions of source code must retain the above copyright notice, this list
  9
+//   of conditions and the following disclaimer.
  10
+//
  11
+// - Redistributions in binary form must reproduce the above copyright notice, this list
  12
+//   of conditions and the following disclaimer in the documentation and/or other materials
  13
+//   provided with the distribution.
  14
+//
  15
+// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
  16
+//   endorse or promote products derived from this software without specific prior written
  17
+//   permission.
  18
+//
  19
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
  20
+// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  21
+// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  22
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  24
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  25
+// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  26
+// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27
+
  28
+using System;
  29
+using System.Drawing;
  30
+using System.Windows.Forms;
  31
+
  32
+namespace ICSharpCode.NRefactory.Demo
  33
+{
  34
+	public partial class VBEditDialog
  35
+	{
  36
+		public VBEditDialog(object element)
  37
+		{
  38
+			InitializeComponent();
  39
+			propertyGrid.SelectedObject = element;
  40
+		}
  41
+	}