Browse Source

Merged Serralongue 2181:2226 to trunk.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2229 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
a1b81828e8
  1. 190
      data/templates/project/CSharp/SharpDevelopCustomTool.xpt
  2. 27
      data/templates/project/CSharp/SharpDevelopCustomToolTemplate.xft.xml
  3. 15
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerLoader/NRefactoryDesignerLoader.cs
  4. 59
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/AddComponentsDialog.cs
  5. 60
      src/AddIns/DisplayBindings/XmlEditor/Project/Resources/AddAttributeDialog.xfrm
  6. 60
      src/AddIns/DisplayBindings/XmlEditor/Project/Resources/AddElementDialog.xfrm
  7. 88
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/AddAttributeDialog.cs
  8. 88
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/AddElementDialog.cs
  9. 339
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/AddXmlNodeDialog.cs
  10. 30
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/IAddAttributeDialog.cs
  11. 11
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/IAddXmlNodeDialog.cs
  12. 22
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlTreeViewContainerControl.cs
  13. 8
      src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.csproj
  14. 325
      src/AddIns/DisplayBindings/XmlEditor/Test/Tree/AddNewNodeDialogTestFixture.cs
  15. 11
      src/AddIns/DisplayBindings/XmlEditor/Test/Tree/PasteTestFixture.cs
  16. 30
      src/AddIns/DisplayBindings/XmlEditor/Test/Tree/XmlTreeViewContainerTestFixture.cs
  17. 39
      src/AddIns/DisplayBindings/XmlEditor/Test/Utils/DerivedAddXmlNodeDialog.cs
  18. 32
      src/AddIns/DisplayBindings/XmlEditor/Test/Utils/DerivedXmlTreeViewContainerControl.cs
  19. 65
      src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockAddAttributeDialog.cs
  20. 29
      src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockAddXmlNodeDialog.cs
  21. 5
      src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj
  22. 2
      src/AddIns/DisplayBindings/XmlEditor/XmlEditor.sln
  23. 3
      src/AddIns/Misc/ComponentInspector/ComponentInspector.AddIn/Src/ComponentInspectorView.cs
  24. 7
      src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/Dialogs/FindDialog.cs
  25. 27
      src/AddIns/Misc/HighlightingEditor/Project/Src/EditHighlightingDialog.cs
  26. 37
      src/AddIns/Misc/ResourceToolkit/Project/Src/Resolver/NRefactoryResourceResolver.cs
  27. 1430
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs
  28. 2
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG
  29. 2
      src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs
  30. 1
      src/Libraries/NRefactory/Project/Src/PrettyPrinter/IOutputAstVisitor.cs
  31. 7
      src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs
  32. 1
      src/Libraries/NRefactory/Project/Src/Visitors/ToCSharpConvertVisitor.cs
  33. 9
      src/Libraries/NRefactory/Project/Src/Visitors/ToVBNetConvertVisitor.cs
  34. 17
      src/Libraries/NRefactory/Project/Src/Visitors/VBNetConstructsConvertVisitor.cs
  35. 22
      src/Libraries/NRefactory/Test/Output/CSharp/VBToCSharpConverterTest.cs
  36. 19
      src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBConverterTest.cs
  37. 6
      src/Libraries/NRefactory/Test/Parser/Statements/LocalVariableDeclarationTests.cs
  38. 32
      src/Main/Base/Project/Src/Services/AmbienceService/AmbienceService.cs
  39. 3
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/ICSharpCode.SharpDevelop.Dom.csproj
  40. 17
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Refactoring/CodeGenerator.cs
  41. 28
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Refactoring/CodeGeneratorOptions.cs
  42. 37
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Refactoring/NRefactoryCodeGenerator.cs
  43. 4
      src/Setup/Files.wxs

190
data/templates/project/CSharp/SharpDevelopCustomTool.xpt

@ -0,0 +1,190 @@ @@ -0,0 +1,190 @@
<?xml version="1.0"?>
<Template originator = "Daniel Grunwald">
<!-- Template Header -->
<TemplateConfiguration>
<Name>Custom Tool</Name>
<Category>C#</Category>
<Subcategory>SharpDevelop</Subcategory>
<Icon>C#.Project.ControlLibrary</Icon>
<Description>A custom tool that implements a code generator transforming a source file into an output file whenever the source is changed inside SharpDevelop</Description>
</TemplateConfiguration>
<!-- Actions -->
<Actions>
<Open filename = "${ProjectName}.addin"/>
</Actions>
<Project language="C#">
<ProjectItems>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ProjectItems>
<PropertyGroup>
<OutputType>Library</OutputType>
</PropertyGroup>
<Files>
<File name="${ProjectName}.addin" CopyToOutputDirectory="Always"><![CDATA[<AddIn name = "${ProjectName}"
author = "${USER}"
url = ""
description = "TODO: Put description here">
<Runtime>
<Import assembly = "${ProjectName}.dll"/>
</Runtime>
<!-- make SharpDevelop look for file templates in your AddIn's directory -->
<Path name = "/SharpDevelop/BackendBindings/Templates">
<Directory id = "${ProjectName}Template" path = "." />
</Path>
<Path name = "/SharpDevelop/CustomTools">
<!--
Register the custom tool.
id: ID used to identify the custom tool. This ID will be used in project files to reference your generator.
class: fully qualified name of a class in your assembly that implements ICustomTool
fileNamePattern: a regular expression. For file names matched by this regex, SharpDevelop will display
your custom tool in the drop down box of the property grid when a file with that extension
is selected.
-->
<CustomTool id = "${ProjectName}Generator"
class = "${StandardNamespace}.${ProjectName}Tool"
fileNamePattern = "\.xml$"/>
</Path>
</AddIn>
]]></File>
<File name="${ProjectName}Tool.cs">
<![CDATA[${StandardHeader.C#}
using System;
using System.IO;
using System.CodeDom;
using System.Xml;
using ICSharpCode.EasyCodeDom; // defined in ICSharpCode.SharpDevelop.Dom.dll
using ICSharpCode.SharpDevelop.Project; // defined in ICSharpCode.SharpDevelop.dll
namespace ${StandardNamespace}
{
/// <summary>
/// Description of CustomTool.
/// </summary>
public class ${ProjectName}Tool : ICustomTool
{
/// <summary>
/// Called by SharpDevelop when your tool has to generate code.
/// </summary>
/// <param name="item">
/// The file for which your tool should generate code.
/// </param>
public void GenerateCode(FileProjectItem item, CustomToolContext context)
{
// make SharpDevelop generate a name for the output file
string outputFileName = context.GetOutputFileName(item, ".Generated");
// if item.FileName is "C:\somedir\SomeName.xml" and is inside a C# project,
// the output name will be "C:\somedir\SomeName.Generated.cs".
// context.GetOutputFileName will always append the extension for compilable files in
// the current project type, so if you want to always output xml, you could use
// string outputFileName = Path.ChangeExtension(item.FileName, ".Generated.xml");
// now read the input file:
XmlDocument doc = new XmlDocument();
doc.Load(item.FileName);
// and generate the code using System.CodeDom:
CodeCompileUnit ccu = GenerateCode(doc, context.OutputNamespace, Path.GetFileNameWithoutExtension(item.FileName));
// Finally save our generated CodeDom compile unit. SharpDevelop will take care of generating
// the code using the correct CodeDomProvider for the project type. This means code-generating
// custom tools are completely language-independent
context.WriteCodeDomToFile(item, outputFileName, ccu);
// If you don't want to generate code, you'll have to write the output file yourself and then use
// context.EnsureOutputFileIsInProject to add the generated file to the project if it isn't already
// part of it.
}
CodeCompileUnit GenerateCode(XmlDocument doc, string targetNamespace, string className)
{
// This method does the actual code generation.
// This sample accepts an object graph as XmlDocument and outputs a class with a static method
// constructing that object graph.
// We'll use ICSharpCode.EasyCodeDom for code generation. This is a small wrapper around CodeDom
// that provides convenience methods that create new objects and add them to the parent simultaniously.
// This makes the generation code much more concise.
// EasyCodeDom classes derive from the System.CodeDom types or have an implicit conversion operator, so
// use can use EasyCodeDom objects whereever CodeDom is expected.
EasyCompileUnit ccu = new EasyCompileUnit();
EasyTypeDeclaration generatedClass = ccu.AddNamespace(targetNamespace).AddType(className);
EasyMethod m = generatedClass.AddMethod("Create");
m.ReturnType = Easy.TypeRef(doc.DocumentElement.Name);
m.Attributes = MemberAttributes.Static | MemberAttributes.Public;
// now generate code. helper variables will be named "v#"
int helperVariableCounter = 0;
string rootVariableName = GenerateCodeForObject(m.Body, doc.DocumentElement, ref helperVariableCounter);
// generate "return v0;"
m.Body.Return(Easy.Var(rootVariableName));
return ccu;
}
string GenerateCodeForObject(EasyBlock block, XmlElement objectElement, ref int helperVariableCounter)
{
// generate code to create the object represented by "objectElement" and add it to the block
// generate "VarType v#;"
CodeVariableDeclarationStatement varDecl;
varDecl = block.DeclareVariable(Easy.TypeRef(objectElement.Name), "v" + helperVariableCounter);
helperVariableCounter += 1;
// generate "VarType v# = new VarType();"
varDecl.InitExpression = Easy.New(Easy.TypeRef(objectElement.Name));
// translate XML attribute to assignments to properties
foreach (XmlAttribute attribute in objectElement.Attributes) {
// generate 'v#.attributeName = "attributeValue";'
// attribute.Value is a string, thus Easy.Prim creates a string literal.
// This simple code generator does not support using other types for attributes.
block.Assign(Easy.Var(varDecl.Name).Property(attribute.Name),
Easy.Prim(attribute.Value));
}
foreach (XmlNode collectionNode in objectElement.ChildNodes) {
XmlElement collectionElement = collectionNode as XmlElement;
if (collectionElement != null) {
foreach (XmlNode itemNode in collectionElement.ChildNodes) {
XmlElement itemElement = itemNode as XmlElement;
if (itemElement != null) {
// add the object represented by "itemElement" to the collection represented by
// "collectionElement".
// generate code to create child object
string childVariableName = GenerateCodeForObject(block, itemElement, ref helperVariableCounter);
// generate 'v#.collectionName.Add(v##)'
block.InvokeMethod(Easy.Var(varDecl.Name).Property(collectionElement.Name),
"Add",
Easy.Var(childVariableName));
}
}
}
}
return varDecl.Name;
}
}
}
]]></File>
<File name="FileTemplate.xft" src="SharpDevelopCustomToolTemplate.xft.xml" binary="true" CopyToOutputDirectory="Always"/>
<File name="AssemblyInfo.cs" src="DefaultAssemblyInfo.cs"/>
</Files>
</Project>
</Template>

27
data/templates/project/CSharp/SharpDevelopCustomToolTemplate.xft.xml

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
<?xml version="1.0"?>
<Template author="-" version="1.0">
<Config
name = "CustomTool Template"
icon = "Icons.32x32.XMLFileIcon"
category = "${res:Templates.File.Categories.Misc}"
defaultname = "CustomToolTemplate${Number}.xml"
language = "XML"/>
<Description>A file template for ${ProjectName}</Description>
<Files>
<File name="${FullName}" language="XML"><![CDATA[<?xml version="1.0"?>
<Form Text = "Form title">
<Controls>
<Button Text = "Click me"/>
<Panel>
<Controls>
<Label Text = "A Label"/>
<Button Text = "Another button"/>
</Controls>
</Panel>
</Controls>
</Form>]]>
</File>
</Files>
</Template>

15
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerLoader/NRefactoryDesignerLoader.cs

@ -175,6 +175,21 @@ namespace ICSharpCode.FormsDesigner @@ -175,6 +175,21 @@ namespace ICSharpCode.FormsDesigner
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.Drawing.Point", 0) == null) {
throw new FormsDesignerLoadException(
StringParser.Parse(
missingReferenceMessage, new string[,] {{ "Name" , "System.Drawing"}}
));
}
if (formClass.ProjectContent.GetClass("System.Windows.Forms.Form", 0) == null) {
throw new FormsDesignerLoadException(
StringParser.Parse(
missingReferenceMessage, new string[,] {{ "Name" , "System.Windows.Forms"}}
));
}
List<KeyValuePair<string, CompilationUnit>> compilationUnits = new List<KeyValuePair<string, CompilationUnit>>();
bool foundInitMethod = false;
foreach (IClass part in parts) {

59
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/AddComponentsDialog.cs

@ -57,12 +57,25 @@ namespace ICSharpCode.FormsDesigner.Gui @@ -57,12 +57,25 @@ namespace ICSharpCode.FormsDesigner.Gui
}
}
void FillComponents(Assembly assembly, string loadPath)
void BeginFillComponentsList()
{
componentListView.BeginUpdate();
componentListView.Items.Clear();
componentListView.Controls.Clear();
}
void EndFillComponentsList(Assembly lastAssembly)
{
if (componentListView.Items.Count == 0) {
if (componentListView.Controls.Count == 0) {
ClearComponentsList(StringParser.Parse("${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.AddSidebarComponents.NoComponentsFound}", new string[,] {{"Name", lastAssembly.FullName}}));
}
}
componentListView.EndUpdate();
}
void AddComponentsToList(Assembly assembly, string loadPath)
{
if (assembly != null) {
Hashtable images = new Hashtable();
ImageList il = new ImageList();
@ -125,13 +138,7 @@ namespace ICSharpCode.FormsDesigner.Gui @@ -125,13 +138,7 @@ namespace ICSharpCode.FormsDesigner.Gui
} catch (Exception e) {
ClearComponentsList(e.Message);
}
if (componentListView.Items.Count == 0) {
if (componentListView.Controls.Count == 0) {
ClearComponentsList(StringParser.Parse("${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.AddSidebarComponents.NoComponentsFound}", new string[,] {{"Name", assembly.FullName}}));
}
}
}
componentListView.EndUpdate();
}
void gacListViewSelectedIndexChanged(object sender, System.EventArgs e)
@ -140,8 +147,11 @@ namespace ICSharpCode.FormsDesigner.Gui @@ -140,8 +147,11 @@ namespace ICSharpCode.FormsDesigner.Gui
string assemblyName = ((ListView)ControlDictionary["gacListView"]).SelectedItems[0].Tag.ToString();
try {
Assembly asm = Assembly.Load(assemblyName);
FillComponents(asm, null);
BeginFillComponentsList();
AddComponentsToList(asm, null);
EndFillComponentsList(asm);
} catch (Exception ex) {
EndFillComponentsList(null);
ClearComponentsList(ex.Message);
}
} else {
@ -164,18 +174,27 @@ namespace ICSharpCode.FormsDesigner.Gui @@ -164,18 +174,27 @@ namespace ICSharpCode.FormsDesigner.Gui
void loadButtonClick(object sender, System.EventArgs e)
{
if (!System.IO.File.Exists(ControlDictionary["fileNameTextBox"].Text)) {
MessageService.ShowWarning("${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.AddSidebarComponents.EnterValidFilename}");
return;
}
BeginFillComponentsList();
try {
string assemblyFileName = ControlDictionary["fileNameTextBox"].Text;
Assembly asm = Assembly.LoadFrom(assemblyFileName);
FillComponents(asm, Path.GetDirectoryName(assemblyFileName));
string assemblyFileNames = ControlDictionary["fileNameTextBox"].Text;
Assembly lastAssembly = null;
foreach (string assemblyFileName in assemblyFileNames.Split(';')) {
if (!System.IO.File.Exists(assemblyFileName)) {
EndFillComponentsList(null);
ClearComponentsList(assemblyFileName + " was not found.");
MessageService.ShowWarning("${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.AddSidebarComponents.EnterValidFilename}");
return;
}
Assembly asm = Assembly.LoadFrom(assemblyFileName);
lastAssembly = asm;
AddComponentsToList(asm, Path.GetDirectoryName(assemblyFileName));
}
EndFillComponentsList(lastAssembly);
} catch {
EndFillComponentsList(null);
MessageService.ShowWarning("${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.AddSidebarComponents.FileIsNotAssembly}");
FillComponents(null, null);
ClearComponentsList(null);
}
}
@ -195,11 +214,11 @@ namespace ICSharpCode.FormsDesigner.Gui @@ -195,11 +214,11 @@ namespace ICSharpCode.FormsDesigner.Gui
fdiag.AddExtension = true;
fdiag.Filter = StringParser.Parse("${res:SharpDevelop.FileFilter.AssemblyFiles}|*.dll;*.exe|${res:SharpDevelop.FileFilter.AllFiles}|*.*");
fdiag.Multiselect = false;
fdiag.Multiselect = true;
fdiag.CheckFileExists = true;
if (fdiag.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) {
ControlDictionary["fileNameTextBox"].Text = fdiag.FileName;
ControlDictionary["fileNameTextBox"].Text = string.Join(";", fdiag.FileNames);
}
}
}

60
src/AddIns/DisplayBindings/XmlEditor/Project/Resources/AddAttributeDialog.xfrm

@ -1,60 +0,0 @@ @@ -1,60 +0,0 @@
<Components version="1.0">
<System.Windows.Forms.Form>
<Name value="AddAttributeDialog" />
<MinimizeBox value="False" />
<StartPosition value="CenterParent" />
<MinimumSize value="191, 155" />
<ShowInTaskbar value="False" />
<Text value="${res:ICSharpCode.XmlEditor.AddAttributeDialog.Title}" />
<MaximizeBox value="False" />
<ClientSize value="{Width=289, Height=244}" />
<ShowIcon value="False" />
<Controls>
<System.Windows.Forms.Label>
<Name value="label1" />
<Location value="5, 179" />
<Text value="${res:ICSharpCode.XmlEditor.AddAttributeDialog.CustomAttributeLabel}" />
<Anchor value="Bottom, Left" />
<Size value="82, 23" />
<TabIndex value="1" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="attributeTextBox" />
<TabIndex value="2" />
<Size value="183, 21" />
<Location value="100, 179" />
<Anchor value="Bottom, Left, Right" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Button>
<Name value="okButton" />
<DialogResult value="OK" />
<Location value="121, 209" />
<Text value="${res:Global.OKButtonText}" />
<Anchor value="Bottom, Right" />
<UseVisualStyleBackColor value="True" />
<Size value="75, 23" />
<TabIndex value="3" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="cancelButton" />
<DialogResult value="Cancel" />
<Location value="202, 209" />
<Text value="${res:Global.CancelButtonText}" />
<Anchor value="Bottom, Right" />
<UseVisualStyleBackColor value="True" />
<Size value="75, 23" />
<TabIndex value="4" />
</System.Windows.Forms.Button>
<System.Windows.Forms.ListBox>
<Name value="attributesListBox" />
<Size value="289, 173" />
<TabIndex value="0" />
<Sorted value="True" />
<SelectionMode value="MultiExtended" />
<FormattingEnabled value="True" />
<Location value="0, 0" />
<Anchor value="Top, Bottom, Left, Right" />
</System.Windows.Forms.ListBox>
</Controls>
</System.Windows.Forms.Form>
</Components>

60
src/AddIns/DisplayBindings/XmlEditor/Project/Resources/AddElementDialog.xfrm

@ -1,60 +0,0 @@ @@ -1,60 +0,0 @@
<Components version="1.0">
<System.Windows.Forms.Form>
<Name value="AddElementDialog" />
<MinimizeBox value="False" />
<StartPosition value="CenterParent" />
<MinimumSize value="191, 155" />
<ShowInTaskbar value="False" />
<Text value="${res:ICSharpCode.XmlEditor.AddElementDialog.Title}" />
<MaximizeBox value="False" />
<ClientSize value="{Width=289, Height=244}" />
<ShowIcon value="False" />
<Controls>
<System.Windows.Forms.Label>
<Name value="customElementLabel" />
<Location value="5, 179" />
<Text value="${res:ICSharpCode.XmlEditor.AddElementDialog.CustomElementLabel}" />
<Anchor value="Bottom, Left" />
<Size value="82, 23" />
<TabIndex value="1" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="elementTextBox" />
<TabIndex value="2" />
<Size value="183, 21" />
<Location value="100, 179" />
<Anchor value="Bottom, Left, Right" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Button>
<Name value="okButton" />
<DialogResult value="OK" />
<Location value="121, 209" />
<Text value="${res:Global.OKButtonText}" />
<Anchor value="Bottom, Right" />
<UseVisualStyleBackColor value="True" />
<Size value="75, 23" />
<TabIndex value="3" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="cancelButton" />
<DialogResult value="Cancel" />
<Location value="202, 209" />
<Text value="${res:Global.CancelButtonText}" />
<Anchor value="Bottom, Right" />
<UseVisualStyleBackColor value="True" />
<Size value="75, 23" />
<TabIndex value="4" />
</System.Windows.Forms.Button>
<System.Windows.Forms.ListBox>
<Name value="elementsListBox" />
<Size value="289, 173" />
<TabIndex value="0" />
<Sorted value="True" />
<SelectionMode value="MultiExtended" />
<FormattingEnabled value="True" />
<Location value="0, 0" />
<Anchor value="Top, Bottom, Left, Right" />
</System.Windows.Forms.ListBox>
</Controls>
</System.Windows.Forms.Form>
</Components>

88
src/AddIns/DisplayBindings/XmlEditor/Project/Src/AddAttributeDialog.cs

@ -1,88 +0,0 @@ @@ -1,88 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Gui.XmlForms;
namespace ICSharpCode.XmlEditor
{
public class AddAttributeDialog : BaseSharpDevelopForm, IAddAttributeDialog
{
ListBox attributesListBox;
Button okButton;
TextBox attributeTextBox;
public AddAttributeDialog(string[] attributeNames)
{
SetupFromXmlStream(GetType().Assembly.GetManifestResourceStream("ICSharpCode.XmlEditor.Resources.AddAttributeDialog.xfrm"));
okButton = (Button)ControlDictionary["okButton"];
okButton.Enabled = false;
AcceptButton = okButton;
CancelButton = (Button)ControlDictionary["cancelButton"];
attributeTextBox = (TextBox)ControlDictionary["attributeTextBox"];
attributeTextBox.TextChanged += AttributeTextBoxTextChanged;
attributesListBox = (ListBox)ControlDictionary["attributesListBox"];
attributesListBox.SelectedIndexChanged += AttributesListBoxSelectedIndexChanged;
foreach (string name in attributeNames) {
attributesListBox.Items.Add(name);
}
}
/// <summary>
/// Gets the attribute names selected.
/// </summary>
public string[] AttributeNames {
get {
List<string> attributeNames = new List<string>();
if (IsAttributeSelected) {
foreach (string attributeName in attributesListBox.SelectedItems) {
attributeNames.Add(attributeName);
}
}
string customAttributeName = attributeTextBox.Text.Trim();
if (customAttributeName.Length > 0) {
attributeNames.Add(customAttributeName);
}
return attributeNames.ToArray();
}
}
void AttributesListBoxSelectedIndexChanged(object source, EventArgs e)
{
okButton.Enabled = IsOkButtonEnabled;
}
void AttributeTextBoxTextChanged(object source, EventArgs e)
{
okButton.Enabled = IsOkButtonEnabled;
}
bool IsAttributeSelected {
get {
return attributesListBox.SelectedIndex >= 0;
}
}
bool IsOkButtonEnabled {
get {
return IsAttributeSelected || IsAttributeNameEntered;
}
}
bool IsAttributeNameEntered {
get {
return attributeTextBox.Text.Trim().Length > 0;
}
}
}
}

88
src/AddIns/DisplayBindings/XmlEditor/Project/Src/AddElementDialog.cs

@ -1,88 +0,0 @@ @@ -1,88 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Gui.XmlForms;
namespace ICSharpCode.XmlEditor
{
public class AddElementDialog : BaseSharpDevelopForm, IAddElementDialog
{
ListBox elementsListBox;
Button okButton;
TextBox elementTextBox;
public AddElementDialog(string[] elementNames)
{
SetupFromXmlStream(GetType().Assembly.GetManifestResourceStream("ICSharpCode.XmlEditor.Resources.AddElementDialog.xfrm"));
okButton = (Button)ControlDictionary["okButton"];
okButton.Enabled = false;
AcceptButton = okButton;
CancelButton = (Button)ControlDictionary["cancelButton"];
elementTextBox = (TextBox)ControlDictionary["elementTextBox"];
elementTextBox.TextChanged += ElementTextBoxTextChanged;
elementsListBox = (ListBox)ControlDictionary["elementsListBox"];
elementsListBox.SelectedIndexChanged += ElementsListBoxSelectedIndexChanged;
foreach (string name in elementNames) {
elementsListBox.Items.Add(name);
}
}
/// <summary>
/// Gets the element names selected.
/// </summary>
public string[] ElementNames {
get {
List<string> elementNames = new List<string>();
if (IsElementSelected) {
foreach (string elementName in elementsListBox.SelectedItems) {
elementNames.Add(elementName);
}
}
string customElementName = elementTextBox.Text.Trim();
if (customElementName.Length > 0) {
elementNames.Add(customElementName);
}
return elementNames.ToArray();
}
}
void ElementsListBoxSelectedIndexChanged(object source, EventArgs e)
{
okButton.Enabled = IsOkButtonEnabled;
}
void ElementTextBoxTextChanged(object source, EventArgs e)
{
okButton.Enabled = IsOkButtonEnabled;
}
bool IsElementSelected {
get {
return elementsListBox.SelectedIndex >= 0;
}
}
bool IsOkButtonEnabled {
get {
return IsElementSelected || IsElementNameEntered;
}
}
bool IsElementNameEntered {
get {
return elementTextBox.Text.Trim().Length > 0;
}
}
}
}

339
src/AddIns/DisplayBindings/XmlEditor/Project/Src/AddXmlNodeDialog.cs

@ -0,0 +1,339 @@ @@ -0,0 +1,339 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Xml;
using ICSharpCode.Core;
namespace ICSharpCode.XmlEditor
{
/// <summary>
/// Base class for the AddElementDialog and AddAttributeDialog. This
/// dialog presents a list of names and an extra text box for entering
/// a custom name. It is used to add a new node to the XML tree. It
/// contains all the core logic for the AddElementDialog and
/// AddAttributeDialog classes.
/// </summary>
public class AddXmlNodeDialog : System.Windows.Forms.Form, IAddXmlNodeDialog
{
public AddXmlNodeDialog() : this(new string[0])
{
}
/// <summary>
/// Creates the dialog and adds the specified names to the
/// list box.
/// </summary>
public AddXmlNodeDialog(string[] names)
{
InitializeComponent();
InitStrings();
if (names.Length > 0) {
AddNames(names);
} else {
RemoveNamesListBox();
}
RightToLeftConverter.ConvertRecursive(this);
}
/// <summary>
/// Gets the selected names in the list box together with the
/// custom name entered in the text box.
/// </summary>
public string[] GetNames()
{
// Add items selected in list box.
List<string> names = new List<string>();
foreach (string name in namesListBox.SelectedItems) {
names.Add(name);
}
// Add the custom name if entered.
string customName = customNameTextBox.Text.Trim();
if (customName.Length > 0) {
names.Add(customName);
}
return names.ToArray();
}
/// <summary>
/// Gets the text from the error provider.
/// </summary>
public string GetError()
{
return errorProvider.GetError(customNameTextBox);
}
/// <summary>
/// Gets or sets the custom name label's text.
/// </summary>
public string CustomNameLabelText {
get {
return customNameTextBoxLabel.Text;
}
set {
customNameTextBoxLabel.Text = value;
}
}
/// <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);
}
protected void NamesListBoxSelectedIndexChanged(object sender, EventArgs e)
{
UpdateOkButtonState();
}
protected void CustomNameTextBoxTextChanged(object sender, EventArgs e)
{
UpdateOkButtonState();
}
#region Windows Forms Designer generated code
void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.namesListBox = new System.Windows.Forms.ListBox();
this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
this.bottomPanel = new System.Windows.Forms.Panel();
this.customNameTextBoxLabel = new System.Windows.Forms.Label();
this.customNameTextBox = new System.Windows.Forms.TextBox();
this.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
this.bottomPanel.SuspendLayout();
this.SuspendLayout();
//
// namesListBox
//
this.namesListBox.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.namesListBox.FormattingEnabled = true;
this.namesListBox.Location = new System.Drawing.Point(0, 0);
this.namesListBox.Name = "namesListBox";
this.namesListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended;
this.namesListBox.Size = new System.Drawing.Size(289, 173);
this.namesListBox.Sorted = true;
this.namesListBox.TabIndex = 1;
this.namesListBox.SelectedIndexChanged += new System.EventHandler(this.NamesListBoxSelectedIndexChanged);
//
// errorProvider
//
this.errorProvider.ContainerControl = this;
//
// bottomPanel
//
this.bottomPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.bottomPanel.Controls.Add(this.customNameTextBoxLabel);
this.bottomPanel.Controls.Add(this.customNameTextBox);
this.bottomPanel.Controls.Add(this.cancelButton);
this.bottomPanel.Controls.Add(this.okButton);
this.bottomPanel.Location = new System.Drawing.Point(0, 173);
this.bottomPanel.Name = "bottomPanel";
this.bottomPanel.Size = new System.Drawing.Size(289, 73);
this.bottomPanel.TabIndex = 2;
//
// customNameTextBoxLabel
//
this.customNameTextBoxLabel.Location = new System.Drawing.Point(3, 10);
this.customNameTextBoxLabel.Name = "customNameTextBoxLabel";
this.customNameTextBoxLabel.Size = new System.Drawing.Size(82, 23);
this.customNameTextBoxLabel.TabIndex = 3;
this.customNameTextBoxLabel.Text = "Custom:";
//
// customNameTextBox
//
this.customNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.customNameTextBox.Location = new System.Drawing.Point(107, 10);
this.customNameTextBox.Name = "customNameTextBox";
this.customNameTextBox.Size = new System.Drawing.Size(167, 20);
this.customNameTextBox.TabIndex = 4;
this.customNameTextBox.TextChanged += new System.EventHandler(this.CustomNameTextBoxTextChanged);
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(199, 40);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 6;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Enabled = false;
this.okButton.Location = new System.Drawing.Point(118, 40);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 5;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
//
// AddXmlNodeDialog
//
this.AcceptButton = this.okButton;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(289, 244);
this.Controls.Add(this.bottomPanel);
this.Controls.Add(this.namesListBox);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(289, 143);
this.Name = "AddXmlNodeDialog";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
this.bottomPanel.ResumeLayout(false);
this.bottomPanel.PerformLayout();
this.ResumeLayout(false);
}
private System.Windows.Forms.Panel bottomPanel;
private System.ComponentModel.IContainer components;
private System.Windows.Forms.ErrorProvider errorProvider;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.TextBox customNameTextBox;
private System.Windows.Forms.Label customNameTextBoxLabel;
private System.Windows.Forms.ListBox namesListBox;
#endregion
/// <summary>
/// Adds the names to the list box.
/// </summary>
void AddNames(string[] names)
{
foreach (string name in names) {
namesListBox.Items.Add(name);
}
}
/// <summary>
/// Enables or disables the ok button depending on whether any list
/// item is selected or a custom name has been entered.
/// </summary>
void UpdateOkButtonState()
{
okButton.Enabled = IsOkButtonEnabled;
}
/// <summary>
/// Returns whether any items are selected in the list box.
/// </summary>
bool IsItemSelected {
get {
return namesListBox.SelectedIndex >= 0;
}
}
bool IsOkButtonEnabled {
get {
return IsItemSelected || ValidateCustomName();
}
}
/// <summary>
/// Returns whether there is a valid string in the custom
/// name text box. The string must be a name that can be used to
/// create an xml element or attribute.
/// </summary>
bool ValidateCustomName()
{
string name = customNameTextBox.Text.Trim();
if (name.Length > 0) {
try {
VerifyName(name);
errorProvider.Clear();
return true;
} catch (XmlException ex) {
errorProvider.SetError(customNameTextBox, ex.Message);
}
}
return false;
}
/// <summary>
/// Checks that the name would make a valid element name or
/// attribute name. Trying to use XmlConvert and its Verify methods
/// so the validation is not done ourselves. XmlDocument has a
/// CheckName method but this is not public.
/// </summary>
void VerifyName(string name)
{
// Check the qualification is valid.
string[] parts = name.Split(new char[] {':'}, 2);
if (parts.Length == 1) {
// No colons.
XmlConvert.VerifyName(name);
return;
}
string firstPart = parts[0].Trim();
string secondPart = parts[1].Trim();
if (firstPart.Length > 0 && secondPart.Length > 0) {
XmlConvert.VerifyNCName(firstPart);
XmlConvert.VerifyNCName(secondPart);
} else {
// Throw an error using VerifyNCName since the
// qualified name parts have no strings.
XmlConvert.VerifyNCName(name);
}
}
/// <summary>
/// Sets the control's text using string resources.
/// </summary>
void InitStrings()
{
okButton.Text = StringParser.Parse("${res:Global.OKButtonText}");
cancelButton.Text = StringParser.Parse("${res:Global.CancelButtonText}");
}
/// <summary>
/// Removes the names list box from the dialog, re-positions the
/// remaining controls and resizes the dialog to fit.
/// </summary>
void RemoveNamesListBox()
{
using (namesListBox) {
Controls.Remove(namesListBox);
// Reset the dialog's minimum size first so setting the
// ClientSize to something smaller works as expected.
MinimumSize = Size.Empty;
ClientSize = bottomPanel.Size;
MinimumSize = Size;
// Make sure bottom panel fills the dialog when it is resized.
bottomPanel.Dock = DockStyle.Fill;
}
}
}
}

30
src/AddIns/DisplayBindings/XmlEditor/Project/Src/IAddAttributeDialog.cs

@ -1,30 +0,0 @@ @@ -1,30 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Windows.Forms;
namespace ICSharpCode.XmlEditor
{
/// <summary>
/// Interface for the AddAttributeDialog.
/// </summary>
public interface IAddAttributeDialog : IDisposable
{
/// <summary>
/// The attribute names that should be added. These are the
/// attribute names that the user selected in the dialog when
/// it was closed.
/// </summary>
string[] AttributeNames {get;}
/// <summary>
/// Shows the dialog.
/// </summary>
DialogResult ShowDialog();
}
}

11
src/AddIns/DisplayBindings/XmlEditor/Project/Src/IAddElementDialog.cs → src/AddIns/DisplayBindings/XmlEditor/Project/Src/IAddXmlNodeDialog.cs

@ -5,22 +5,23 @@ @@ -5,22 +5,23 @@
// <version>$Revision$</version>
// </file>
using System;
using System.Windows.Forms;
namespace ICSharpCode.XmlEditor
{
/// <summary>
/// Interface for the AddElementDialog.
/// Interface for the AddXmlNodeDialog.
/// </summary>
public interface IAddElementDialog : IDisposable
public interface IAddXmlNodeDialog : IDisposable
{
/// <summary>
/// The element names that should be added. These are the
/// element names that the user selected in the dialog when
/// The names that should be added. These are the
/// names that the user selected in the dialog when
/// it was closed.
/// </summary>
string[] ElementNames {get;}
string[] GetNames();
/// <summary>
/// Shows the dialog.

22
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlTreeViewContainerControl.cs

@ -296,9 +296,9 @@ namespace ICSharpCode.XmlEditor @@ -296,9 +296,9 @@ namespace ICSharpCode.XmlEditor
/// <returns>The attributes selected by the user.</returns>
public string[] SelectNewAttributes(string[] attributes)
{
using (IAddAttributeDialog addAttributeDialog = CreateAddAttributeDialog(attributes)) {
using (IAddXmlNodeDialog addAttributeDialog = CreateAddAttributeDialog(attributes)) {
if (addAttributeDialog.ShowDialog() == DialogResult.OK) {
return addAttributeDialog.AttributeNames;
return addAttributeDialog.GetNames();
}
return new string[0];
}
@ -321,9 +321,9 @@ namespace ICSharpCode.XmlEditor @@ -321,9 +321,9 @@ namespace ICSharpCode.XmlEditor
/// <returns>The elements selected by the user.</returns>
public string[] SelectNewElements(string[] elements)
{
using (IAddElementDialog addElementDialog = CreateAddElementDialog(elements)) {
using (IAddXmlNodeDialog addElementDialog = CreateAddElementDialog(elements)) {
if (addElementDialog.ShowDialog() == DialogResult.OK) {
return addElementDialog.ElementNames;
return addElementDialog.GetNames();
}
return new string[0];
}
@ -649,9 +649,12 @@ namespace ICSharpCode.XmlEditor @@ -649,9 +649,12 @@ namespace ICSharpCode.XmlEditor
/// </summary>
/// <param name="elementNames">The element names to be listed in the
/// dialog.</param>
protected virtual IAddElementDialog CreateAddElementDialog(string[] elementNames)
protected virtual IAddXmlNodeDialog CreateAddElementDialog(string[] elementNames)
{
return new AddElementDialog(elementNames);
AddXmlNodeDialog dialog = new AddXmlNodeDialog(elementNames);
dialog.Text = StringParser.Parse("${res:ICSharpCode.XmlEditor.AddElementDialog.Title}");
dialog.CustomNameLabelText = StringParser.Parse("${res:ICSharpCode.XmlEditor.AddElementDialog.CustomElementLabel}");
return dialog;
}
/// <summary>
@ -659,9 +662,12 @@ namespace ICSharpCode.XmlEditor @@ -659,9 +662,12 @@ namespace ICSharpCode.XmlEditor
/// </summary>
/// <param name="attributeNames">The attribute names to be listed in the
/// dialog.</param>
protected virtual IAddAttributeDialog CreateAddAttributeDialog(string[] attributeNames)
protected virtual IAddXmlNodeDialog CreateAddAttributeDialog(string[] attributeNames)
{
return new AddAttributeDialog(attributeNames);
AddXmlNodeDialog dialog = new AddXmlNodeDialog(attributeNames);
dialog.Text = StringParser.Parse("${res:ICSharpCode.XmlEditor.AddAttributeDialog.Title}");
dialog.CustomNameLabelText = StringParser.Parse("${res:ICSharpCode.XmlEditor.AddAttributeDialog.CustomAttributeLabel}");
return dialog;
}
/// <summary>

8
src/AddIns/DisplayBindings/XmlEditor/Project/XmlEditor.csproj

@ -56,8 +56,8 @@ @@ -56,8 +56,8 @@
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\AddChildCommentCommand.cs" />
<Compile Include="Src\AddChildTextNodeCommand.cs" />
<Compile Include="Src\IAddAttributeDialog.cs" />
<Compile Include="Src\IAddElementDialog.cs" />
<Compile Include="Src\AddXmlNodeDialog.cs" />
<Compile Include="Src\IAddXmlNodeDialog.cs" />
<Compile Include="Src\InsertCommentAfterCommand.cs" />
<Compile Include="Src\InsertCommentBeforeCommand.cs" />
<Compile Include="Src\InsertTextNodeAfterCommand.cs" />
@ -138,12 +138,8 @@ @@ -138,12 +138,8 @@
<Compile Include="Src\XmlAttributePropertyDescriptor.cs" />
<Compile Include="Src\XmlAttributeTypeDescriptor.cs" />
<Compile Include="Src\XmlEncoder.cs" />
<EmbeddedResource Include="Resources\AddAttributeDialog.xfrm" />
<Compile Include="Src\AddAttributeDialog.cs" />
<Compile Include="Src\AddAttributeCommand.cs" />
<Compile Include="Src\RemoveAttributeCommand.cs" />
<EmbeddedResource Include="Resources\AddElementDialog.xfrm" />
<Compile Include="Src\AddElementDialog.cs" />
<Compile Include="Src\AddChildElementCommand.cs" />
<Compile Include="Src\InsertElementBeforeCommand.cs" />
<Compile Include="Src\InsertElementAfterCommand.cs" />

325
src/AddIns/DisplayBindings/XmlEditor/Test/Tree/AddNewNodeDialogTestFixture.cs

@ -0,0 +1,325 @@ @@ -0,0 +1,325 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
using System.Xml;
using ICSharpCode.Core;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using XmlEditor.Tests.Utils;
namespace XmlEditor.Tests.Tree
{
/// <summary>
/// Tests the AddXmlNodeDialog which is the base class for the
/// AddElementDialog and the AddAttributeDialog classes. All the
/// core logic for the two add dialogs is located in the AddXmlNodeDialog
/// since their behaviour is the same.
/// </summary>
[TestFixture]
public class AddNewNodeDialogTestFixture
{
DerivedAddXmlNodeDialog dialog;
ListBox namesListBox;
string[] names;
Button okButton;
Button cancelButton;
TextBox customNameTextBox;
Label customNameTextBoxLabel;
Panel bottomPanel;
[TestFixtureSetUp]
public void SetUpFixture()
{
if (!PropertyService.Initialized) {
PropertyService.InitializeService(String.Empty, String.Empty, String.Empty);
}
}
[SetUp]
public void Init()
{
names = new string[] {"Chimpanzee", "Monkey"};
dialog = new DerivedAddXmlNodeDialog(names);
// Get the various dialog controls that are to be used in this
// test fixture.
bottomPanel = (Panel)dialog.Controls["bottomPanel"];
namesListBox = (ListBox)dialog.Controls["namesListBox"];
okButton = (Button)bottomPanel.Controls["okButton"];
cancelButton = (Button)bottomPanel.Controls["cancelButton"];
customNameTextBox = (TextBox)bottomPanel.Controls["customNameTextBox"];
customNameTextBoxLabel = (Label)bottomPanel.Controls["customNameTextBoxLabel"];
}
[TearDown]
public void TearDown()
{
dialog.Dispose();
}
[Test]
public void TwoNamesAddedToListBox()
{
Assert.AreEqual(2, namesListBox.Items.Count);
}
[Test]
public void NamesAddedToListBox()
{
Assert.Contains("Chimpanzee", namesListBox.Items);
Assert.Contains("Monkey", namesListBox.Items);
}
[Test]
public void OkButtonInitiallyDisabled()
{
Assert.IsFalse(okButton.Enabled);
}
[Test]
public void OkButtonIsDialogAcceptButton()
{
Assert.AreSame(okButton, dialog.AcceptButton);
}
[Test]
public void CancelButtonIsDialogCancelButton()
{
Assert.AreSame(cancelButton, dialog.CancelButton);
}
/// <summary>
/// The dialog's Names property should not return any items
/// when nothing is selected in the list box or added to the
/// custom name text box.
/// </summary>
[Test]
public void NoNamesInitiallySelected()
{
Assert.AreEqual(0, dialog.GetNames().Length);
}
[Test]
public void NamesSelectedAfterSelectingOneListBoxItem()
{
namesListBox.SelectedIndex = 0;
string[] expectedNames = new string[] {(string)namesListBox.Items[0]};
string[] names = dialog.GetNames();
Assert.AreEqual(expectedNames, names);
}
[Test]
public void NamesSelectedAfterSelectingTwoListBoxItems()
{
namesListBox.SelectedIndices.Add(0);
namesListBox.SelectedIndices.Add(1);
string[] expectedNames = new string[] {(string)namesListBox.Items[0], (string)namesListBox.Items[1]};
string[] names = dialog.GetNames();
Assert.AreEqual(expectedNames, names);
}
/// <summary>
/// Tests that the returned names from the dialog includes any
/// text in the custom name text box. Also check that the text box's
/// text is trimmed.
/// </summary>
[Test]
public void NamesSelectedAfterEnteringCustomName()
{
string customName = " customname ";
customNameTextBox.Text = customName;
string[] expectedNames = new string[] {customName.Trim()};
string[] names = dialog.GetNames();
Assert.AreEqual(expectedNames, names);
}
[Test]
public void OkButtonEnabledWhenListItemSelected()
{
namesListBox.SelectedIndex = 0;
dialog.CallNamesListBoxSelectedIndexChanged();
Assert.IsTrue(okButton.Enabled);
}
[Test]
public void OkButtonEnabledWhenCustomNameEntered()
{
customNameTextBox.Text = "Custom";
dialog.CallCustomNameTextBoxTextChanged();
Assert.IsTrue(okButton.Enabled);
}
/// <summary>
/// Tests that a custom name string that contains spaces does not
/// cause the OK button to be enabled.
/// </summary>
[Test]
public void OkButtonDisabledWhenEmptyCustomNameStringEntered()
{
customNameTextBox.Text = " ";
dialog.CallCustomNameTextBoxTextChanged();
Assert.IsFalse(okButton.Enabled);
}
[Test]
public void InvalidCustomNameEntered()
{
customNameTextBox.Text = "<element>";
dialog.CallCustomNameTextBoxTextChanged();
string error = dialog.GetError();
string expectedError = null;
try {
XmlConvert.VerifyName(customNameTextBox.Text);
Assert.Fail("XmlConvert.VerifyName should have failed.");
} catch (Exception ex) {
expectedError = ex.Message;
}
Assert.IsFalse(okButton.Enabled);
Assert.AreEqual(expectedError, error);
}
[Test]
public void CustomNameWithTwoColonCharsEntered()
{
customNameTextBox.Text = "xsl:test:this";
dialog.CallCustomNameTextBoxTextChanged();
string error = dialog.GetError();
Assert.IsFalse(okButton.Enabled);
Assert.IsTrue(error.Length > 0);
}
[Test]
public void CustomNameWithOneColonCharEntered()
{
customNameTextBox.Text = "xsl:test";
dialog.CallCustomNameTextBoxTextChanged();
string error = dialog.GetError();
Assert.IsTrue(okButton.Enabled);
Assert.AreEqual(0, error.Length);
}
[Test]
public void CustomNameWithOneColonCharAtStart()
{
customNameTextBox.Text = ":test";
dialog.CallCustomNameTextBoxTextChanged();
string error = dialog.GetError();
Assert.IsFalse(okButton.Enabled);
Assert.IsTrue(error.Length > 0);
}
[Test]
public void ErrorClearedAfterTextChanged()
{
InvalidCustomNameEntered();
customNameTextBox.Text = "element";
dialog.CallCustomNameTextBoxTextChanged();
Assert.IsTrue(okButton.Enabled);
Assert.AreEqual(0, dialog.GetError().Length);
}
[Test]
public void StartPositionIsCenterParent()
{
Assert.AreEqual(FormStartPosition.CenterParent, dialog.StartPosition);
}
[Test]
public void OkButtonDialogResult()
{
Assert.AreEqual(DialogResult.OK, okButton.DialogResult);
}
[Test]
public void CancelButtonDialogResult()
{
Assert.AreEqual(DialogResult.Cancel, cancelButton.DialogResult);
}
[Test]
public void ShowInTaskBar()
{
Assert.IsFalse(dialog.ShowInTaskbar);
}
[Test]
public void MinimizeBox()
{
Assert.IsFalse(dialog.MinimizeBox);
}
[Test]
public void MaximizeBox()
{
Assert.IsFalse(dialog.MaximizeBox);
}
[Test]
public void ShowIcon()
{
Assert.IsFalse(dialog.ShowIcon);
}
[Test]
public void SetCustomNameLabel()
{
dialog.CustomNameLabelText = "test";
Assert.AreEqual("test", dialog.CustomNameLabelText);
Assert.AreEqual("test", customNameTextBoxLabel.Text);
}
[Test]
public void RightToLeftConversion()
{
try {
PropertyService.Set("CoreProperties.UILanguage", RightToLeftConverter.RightToLeftLanguages[0]);
using (AddXmlNodeDialog dialog = new AddXmlNodeDialog()) {
Assert.AreEqual(RightToLeft.Yes, dialog.RightToLeft);
}
} finally {
PropertyService.Set("CoreProperties.UILanguage", Thread.CurrentThread.CurrentUICulture.Name);
}
}
/// <summary>
/// Check that the list box is not on the form when there are no
/// names passed to the constructor of AddXmlNodeDialog.
/// </summary>
[Test]
public void NoListBoxShownWhenNoNames()
{
using (AddXmlNodeDialog dialog = new AddXmlNodeDialog(new string[0])) {
Size expectedClientSize = this.bottomPanel.Size;
Size expectedMinSize = dialog.Size;
Panel bottomPanel = (Panel)dialog.Controls["bottomPanel"];
Assert.IsFalse(dialog.Controls.ContainsKey("namesListBox"));
Assert.AreEqual(DockStyle.Fill, bottomPanel.Dock);
Assert.AreEqual(expectedClientSize, dialog.ClientSize);
Assert.AreEqual(expectedMinSize, dialog.MinimumSize);
}
}
}
}

11
src/AddIns/DisplayBindings/XmlEditor/Test/Tree/PasteTestFixture.cs

@ -349,6 +349,17 @@ namespace XmlEditor.Tests.Tree @@ -349,6 +349,17 @@ namespace XmlEditor.Tests.Tree
Assert.IsNull(bodyElement.SelectSingleNode("p"));
}
[Test]
public void CopyThenPasteToUnsupportedNode()
{
XmlNode node = editor.Document.CreateProcessingInstruction("a", "b");
mockXmlTreeView.SelectedNode = node;
editor.Copy();
mockXmlTreeView.SelectedElement = rootElement;
Assert.IsFalse(editor.IsPasteEnabled);
}
/// <summary>
/// Returns the xhtml strict schema as the default schema.
/// </summary>

30
src/AddIns/DisplayBindings/XmlEditor/Test/Tree/XmlTreeViewContainerTestFixture.cs

@ -9,6 +9,7 @@ using System; @@ -9,6 +9,7 @@ using System;
using System.Windows.Forms;
using System.Xml;
using ICSharpCode.Core;
using ICSharpCode.XmlEditor;
using NUnit.Framework;
using XmlEditor.Tests.Utils;
@ -34,6 +35,15 @@ namespace XmlEditor.Tests.Tree @@ -34,6 +35,15 @@ namespace XmlEditor.Tests.Tree
XmlElementTreeNode htmlTreeNode;
XmlTextTreeNode textTreeNode;
[TestFixtureSetUp]
public void SetUpFixture()
{
// Need to initialize the properties service.
if (!PropertyService.Initialized) {
PropertyService.InitializeService(String.Empty, String.Empty, String.Empty);
}
}
[SetUp]
public void Init()
{
@ -410,6 +420,26 @@ namespace XmlEditor.Tests.Tree @@ -410,6 +420,26 @@ namespace XmlEditor.Tests.Tree
Assert.IsNull(htmlTreeNode.XmlElement.SelectSingleNode("text()"));
}
[Test]
public void CreateAddAttributeDialog()
{
AddXmlNodeDialog dialog = (AddXmlNodeDialog)treeViewContainer.CallCreateAddAttributeDialog(new string[0]);
Panel bottomPanel = (Panel)dialog.Controls["bottomPanel"];
Label customNameTextBoxLabel = (Label)bottomPanel.Controls["customNameTextBoxLabel"];
Assert.AreEqual(StringParser.Parse("${res:ICSharpCode.XmlEditor.AddAttributeDialog.Title}"), dialog.Text);
Assert.AreEqual(StringParser.Parse("${res:ICSharpCode.XmlEditor.AddAttributeDialog.CustomAttributeLabel}"), customNameTextBoxLabel.Text);
}
[Test]
public void CreateAddElementeDialog()
{
AddXmlNodeDialog dialog = (AddXmlNodeDialog)treeViewContainer.CallCreateAddElementDialog(new string[0]);
Panel bottomPanel = (Panel)dialog.Controls["bottomPanel"];
Label customNameTextBoxLabel = (Label)bottomPanel.Controls["customNameTextBoxLabel"];
Assert.AreEqual(StringParser.Parse("${res:ICSharpCode.XmlEditor.AddElementDialog.Title}"), dialog.Text);
Assert.AreEqual(StringParser.Parse("${res:ICSharpCode.XmlEditor.AddElementDialog.CustomElementLabel}"), customNameTextBoxLabel.Text);
}
void TreeViewContainerDirtyChanged(object source, EventArgs e)
{
dirtyChanged = true;

39
src/AddIns/DisplayBindings/XmlEditor/Test/Utils/DerivedAddXmlNodeDialog.cs

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.XmlEditor;
namespace XmlEditor.Tests.Utils
{
/// <summary>
/// Derived version of the AddXmlNodeDialog which allows us to test
/// various protected methods.
/// </summary>
public class DerivedAddXmlNodeDialog : AddXmlNodeDialog
{
public DerivedAddXmlNodeDialog(string[] names) : base(names)
{
}
/// <summary>
/// Calls the base class's NamesListBoxSelectedIndexChanged method.
/// </summary>
public void CallNamesListBoxSelectedIndexChanged()
{
base.NamesListBoxSelectedIndexChanged(this, new EventArgs());
}
/// <summary>
/// Calls the base class's CustomNameTextBoxTextChanged method.
/// </summary>
public void CallCustomNameTextBoxTextChanged()
{
base.CustomNameTextBoxTextChanged(this, new EventArgs());
}
}
}

32
src/AddIns/DisplayBindings/XmlEditor/Test/Utils/DerivedXmlTreeViewContainerControl.cs

@ -111,23 +111,39 @@ namespace XmlEditor.Tests.Utils @@ -111,23 +111,39 @@ namespace XmlEditor.Tests.Utils
}
/// <summary>
/// Returns a new MockAddElementDialog for testing.
/// Calls the XmlTreeViewContainer's CreateAddAttributeDialog method.
/// </summary>
protected override IAddElementDialog CreateAddElementDialog(string[] elementNames)
public IAddXmlNodeDialog CallCreateAddAttributeDialog(string[] names)
{
MockAddElementDialog dialog = new MockAddElementDialog();
dialog.SetElementNamesToReturn(addElementDialogElementNamesReturned.ToArray());
return base.CreateAddAttributeDialog(names);
}
/// <summary>
/// Calls the XmlTreeViewContainer's CreateAddElementDialog method.
/// </summary>
public IAddXmlNodeDialog CallCreateAddElementDialog(string[] names)
{
return base.CreateAddElementDialog(names);
}
/// <summary>
/// Returns a new MockAddXmlNodeDialog for testing.
/// </summary>
protected override IAddXmlNodeDialog CreateAddElementDialog(string[] elementNames)
{
MockAddXmlNodeDialog dialog = new MockAddXmlNodeDialog();
dialog.SetNamesToReturn(addElementDialogElementNamesReturned.ToArray());
dialog.SetDialogResult(addElementDialogResult);
return dialog;
}
/// <summary>
/// Returns a new MockAddAttributeDialog for testing.
/// Returns a new MockAddXmlNodeDialog for testing.
/// </summary>
protected override IAddAttributeDialog CreateAddAttributeDialog(string[] attributeNames)
protected override IAddXmlNodeDialog CreateAddAttributeDialog(string[] attributeNames)
{
MockAddAttributeDialog dialog = new MockAddAttributeDialog();
dialog.SetAttributeNamesToReturn(addAttributeDialogAttributeNamesReturned.ToArray());
MockAddXmlNodeDialog dialog = new MockAddXmlNodeDialog();
dialog.SetNamesToReturn(addAttributeDialogAttributeNamesReturned.ToArray());
dialog.SetDialogResult(addAttributeDialogResult);
return dialog;
}

65
src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockAddAttributeDialog.cs

@ -1,65 +0,0 @@ @@ -1,65 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ICSharpCode.XmlEditor;
namespace XmlEditor.Tests.Utils
{
/// <summary>
/// Mocks the AddAttributeDialog so we can test the
/// XmlTreeViewContainerControl class when it displays
/// the AddAttributeDialog.
/// </summary>
public class MockAddAttributeDialog : IAddAttributeDialog
{
DialogResult dialogResult = DialogResult.OK;
List<string> attributeNames = new List<string>();
/// <summary>
/// Specifies the attribute names to return from the
/// IAddAttributeDialog.AttributeNames property.
/// </summary>
public void SetAttributeNamesToReturn(string[] names)
{
attributeNames.Clear();
foreach (string name in names) {
attributeNames.Add(name);
}
}
/// <summary>
/// Specifies the dialog result to return from the
/// IAddAttributeDialog.ShowDialog method.
/// </summary>
public void SetDialogResult(DialogResult result)
{
dialogResult = result;
}
#region IAddAttributeDialog implementation
public string[] AttributeNames {
get {
return attributeNames.ToArray();
}
}
public DialogResult ShowDialog()
{
return dialogResult;
}
public void Dispose()
{
}
#endregion
}
}

29
src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockAddElementDialog.cs → src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockAddXmlNodeDialog.cs

@ -13,42 +13,41 @@ using ICSharpCode.XmlEditor; @@ -13,42 +13,41 @@ using ICSharpCode.XmlEditor;
namespace XmlEditor.Tests.Utils
{
/// <summary>
/// Mocks the AddElementDialog so we can test the
/// Mocks the AddXmlNodeDialog so we can test the
/// XmlTreeViewContainerControl class when it displays
/// the AddElementDialog.
/// the AddElementDialog or the AddAttributeDialog.
/// </summary>
public class MockAddElementDialog : IAddElementDialog
public class MockAddXmlNodeDialog : IAddXmlNodeDialog
{
DialogResult dialogResult = DialogResult.OK;
List<string> elementNames = new List<string>();
List<string> names = new List<string>();
/// <summary>
/// Specifies the element names to return from the
/// IAddElementDialog.ElementNames property.
/// Specifies the names to return from the
/// IAddXmlNodeDialog.GetNames method.
/// </summary>
public void SetElementNamesToReturn(string[] names)
public void SetNamesToReturn(string[] names)
{
elementNames.Clear();
this.names.Clear();
foreach (string name in names) {
elementNames.Add(name);
this.names.Add(name);
}
}
/// <summary>
/// Specifies the dialog result to return from the
/// IAddElementDialog.ShowDialog method.
/// IAddXmlNodeDialog.ShowDialog method.
/// </summary>
public void SetDialogResult(DialogResult result)
{
dialogResult = result;
}
#region IAddElementDialog implementation
#region IAddXmlNodeDialog implementation
public string[] ElementNames {
get {
return elementNames.ToArray();
}
public string[] GetNames()
{
return names.ToArray();
}
public DialogResult ShowDialog()

5
src/AddIns/DisplayBindings/XmlEditor/Test/XmlEditor.Tests.csproj

@ -72,6 +72,7 @@ @@ -72,6 +72,7 @@
<Compile Include="Schema\NestedChoiceTestFixture.cs" />
<Compile Include="Schema\ChildElementAttributesTestFixture.cs" />
<Compile Include="Tree\AddChildTextNodeTestFixture.cs" />
<Compile Include="Tree\AddNewNodeDialogTestFixture.cs" />
<Compile Include="Tree\DeleteTreeNodeWithDeleteKeyTestFixture.cs" />
<Compile Include="Tree\EditCommentNodesInTreeControlTestFixture.cs" />
<Compile Include="Tree\EditCommentNodesTestFixture.cs" />
@ -89,10 +90,10 @@ @@ -89,10 +90,10 @@
<Compile Include="Tree\XmlCommentTreeNodeTests.cs" />
<Compile Include="Tree\XmlTreeViewClipboardHandlerTestFixture.cs" />
<Compile Include="Tree\XmlTreeViewContainerTestFixture.cs" />
<Compile Include="Utils\DerivedAddXmlNodeDialog.cs" />
<Compile Include="Utils\DerivedXmlTreeView.cs" />
<Compile Include="Utils\DerivedXmlTreeViewContainerControl.cs" />
<Compile Include="Utils\MockAddAttributeDialog.cs" />
<Compile Include="Utils\MockAddElementDialog.cs" />
<Compile Include="Utils\MockAddXmlNodeDialog.cs" />
<Compile Include="Utils\ResourceManager.cs" />
<Compile Include="Schema\XhtmlStrictSchemaTestFixture.cs" />
<Compile Include="Schema\XsdSchemaTestFixture.cs" />

2
src/AddIns/DisplayBindings/XmlEditor/XmlEditor.sln

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
# SharpDevelop 2.1.0.2147
# SharpDevelop 2.1.0.2169
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XmlEditor", "Project\XmlEditor.csproj", "{6B717BD1-CD5E-498C-A42E-9E6A4584DC48}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XmlEditor.Tests", "Test\XmlEditor.Tests.csproj", "{FC0FE702-A87D-4D70-A9B6-1ECCD611125F}"

3
src/AddIns/Misc/ComponentInspector/ComponentInspector.AddIn/Src/ComponentInspectorView.cs

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
using System;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using NoGoop.ObjBrowser;
@ -75,7 +76,7 @@ namespace ICSharpCode.ComponentInspector.AddIn @@ -75,7 +76,7 @@ namespace ICSharpCode.ComponentInspector.AddIn
public override string TitleName {
get {
return "${res:ComponentInspector.ToolsMenu.ShowComponentInspectorMenuItem}";
return StringParser.Parse("${res:ComponentInspector.ToolsMenu.ShowComponentInspectorMenuItem}");
}
set {
}

7
src/AddIns/Misc/ComponentInspector/ComponentInspector.Core/Src/ObjectBrowser/Dialogs/FindDialog.cs

@ -598,9 +598,12 @@ namespace NoGoop.ObjBrowser.Dialogs @@ -598,9 +598,12 @@ namespace NoGoop.ObjBrowser.Dialogs
// Materialize can sometimes take a while
Cursor save = Cursor.Current;
Cursor.Current = Cursors.WaitCursor;
((ISearchMaterializer)_foundList.SelectedItems[0].Tag).PointToNode();
ISearchMaterializer searchMaterializer = _foundList.SelectedItems[0].Tag as ISearchMaterializer;
if (searchMaterializer != null) {
searchMaterializer.PointToNode();
Close();
}
Cursor.Current = save;
Close();
}
protected void LayoutHandler(object sender, LayoutEventArgs e)

27
src/AddIns/Misc/HighlightingEditor/Project/Src/EditHighlightingDialog.cs

@ -13,8 +13,8 @@ using System.Windows.Forms; @@ -13,8 +13,8 @@ using System.Windows.Forms;
using ICSharpCode.SharpDevelop.AddIns.HighlightingEditor.Nodes;
using ICSharpCode.SharpDevelop.Gui.XmlForms;
namespace ICSharpCode.SharpDevelop.Gui {
namespace ICSharpCode.SharpDevelop.Gui
{
public class EditHighlightingDialog : BaseSharpDevelopForm
{
private System.Windows.Forms.Button acceptBtn;
@ -61,6 +61,15 @@ namespace ICSharpCode.SharpDevelop.Gui { @@ -61,6 +61,15 @@ namespace ICSharpCode.SharpDevelop.Gui {
nodeTree.SelectedNode = topNode;
}
protected override void Dispose(bool disposing)
{
if (disposing) {
nodeTree.Nodes.Clear();
optionPanel.Controls.Clear();
}
base.Dispose(disposing);
}
void cancelClick(object sender, EventArgs e)
{
if (currentPanel != null) {
@ -68,9 +77,7 @@ namespace ICSharpCode.SharpDevelop.Gui { @@ -68,9 +77,7 @@ namespace ICSharpCode.SharpDevelop.Gui {
optionPanel.Controls.Clear();
}
nodeTree.Nodes.Clear();
DialogResult = DialogResult.Cancel;
}
void acceptClick(object sender, EventArgs e)
@ -81,12 +88,9 @@ namespace ICSharpCode.SharpDevelop.Gui { @@ -81,12 +88,9 @@ namespace ICSharpCode.SharpDevelop.Gui {
}
currentPanel.StoreSettings();
currentPanel.ParentNode.UpdateNodeText();
optionPanel.Controls.Clear();
}
nodeTree.Nodes.Clear();
DialogResult = DialogResult.OK;
}
@ -102,7 +106,7 @@ namespace ICSharpCode.SharpDevelop.Gui { @@ -102,7 +106,7 @@ namespace ICSharpCode.SharpDevelop.Gui {
new Rectangle(0, 0, Width, Height));
}
public GradientLabel() : base()
public GradientLabel()
{
UseMnemonic = false;
}
@ -110,7 +114,7 @@ namespace ICSharpCode.SharpDevelop.Gui { @@ -110,7 +114,7 @@ namespace ICSharpCode.SharpDevelop.Gui {
private NodeOptionPanel currentPanel;
void NodeTreeBeforeSelect(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
void NodeTreeBeforeSelect(object sender, TreeViewCancelEventArgs e)
{
if (currentPanel != null) {
if (!currentPanel.ValidateSettings()) {
@ -120,7 +124,7 @@ namespace ICSharpCode.SharpDevelop.Gui { @@ -120,7 +124,7 @@ namespace ICSharpCode.SharpDevelop.Gui {
}
}
void NodeTreeAfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
void NodeTreeAfterSelect(object sender, TreeViewEventArgs e)
{
if (currentPanel != null) {
currentPanel.StoreSettings();
@ -136,9 +140,6 @@ namespace ICSharpCode.SharpDevelop.Gui { @@ -136,9 +140,6 @@ namespace ICSharpCode.SharpDevelop.Gui {
}
gradientLabel.Text = " " + e.Node.Text;
}
}
}

37
src/AddIns/Misc/ResourceToolkit/Project/Src/Resolver/NRefactoryResourceResolver.cs

@ -184,9 +184,40 @@ namespace Hornung.ResourceToolkit.Resolver @@ -184,9 +184,40 @@ namespace Hornung.ResourceToolkit.Resolver
if (resourceName.StartsWith(p.RootNamespace, StringComparison.InvariantCultureIgnoreCase)) {
// Look for a resource file in the project with the exact name.
if ((fileName = FindResourceFileName(Path.Combine(p.Directory, resourceName.Substring(p.RootNamespace.Length+1).Replace('.', Path.DirectorySeparatorChar)))) != null) {
return new ResourceSetReference(resourceName, fileName);
if (p.Language == "VBNet") {
// SD2-1239
// The VB MSBuild tasks do not use the folder names
// in the manifest resource names.
// We have to look in all folders of the project
// for a file with the specified resource name.
// Need to add a dummy extension so that FindResourceFileName
// does not remove parts of the actual file name when it
// contains a dot.
string fileNameWithDummyExtension = String.Concat(resourceName.Substring(p.RootNamespace.Length+1), ".x");
// Search in the project root folder
// (this folder is not specified explicitly in
// the MSBuild project)
if ((fileName = FindResourceFileName(Path.Combine(p.Directory, fileNameWithDummyExtension))) != null) {
return new ResourceSetReference(resourceName, fileName);
}
// Search in all project folders
foreach (ProjectItem folder in p.GetItemsOfType(ItemType.Folder)) {
if ((fileName = FindResourceFileName(Path.Combine(folder.FileName, fileNameWithDummyExtension))) != null) {
return new ResourceSetReference(resourceName, fileName);
}
}
} else {
// Look for a resource file in the project with the exact name.
if ((fileName = FindResourceFileName(Path.Combine(p.Directory, resourceName.Substring(p.RootNamespace.Length+1).Replace('.', Path.DirectorySeparatorChar)))) != null) {
return new ResourceSetReference(resourceName, fileName);
}
}
}

1430
src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs

File diff suppressed because it is too large Load Diff

2
src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG

@ -1381,8 +1381,6 @@ VariableDeclaratorPartAfterIdentifier<List<VariableDeclaration> fieldDeclaration @@ -1381,8 +1381,6 @@ VariableDeclaratorPartAfterIdentifier<List<VariableDeclaration> fieldDeclaration
if(type.RankSpecifier != null) {
Error("array rank only allowed one time");
} else {
for (int i = 0; i < dimension.Count; i++)
dimension[i] = Expression.AddInteger(dimension[i], 1);
if (rank == null) {
type.RankSpecifier = new int[] { dimension.Count - 1 };
} else {

2
src/Libraries/NRefactory/Project/Src/PrettyPrinter/CSharp/CSharpOutputVisitor.cs

@ -41,12 +41,10 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -41,12 +41,10 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
AbstractPrettyPrintOptions IOutputAstVisitor.Options {
get { return prettyPrintOptions; }
set { prettyPrintOptions = (PrettyPrintOptions)value; }
}
public PrettyPrintOptions Options {
get { return prettyPrintOptions; }
set { prettyPrintOptions = value; }
}
public IOutputFormatter OutputFormatter {

1
src/Libraries/NRefactory/Project/Src/PrettyPrinter/IOutputAstVisitor.cs

@ -29,7 +29,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -29,7 +29,6 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
AbstractPrettyPrintOptions Options {
get;
set;
}
IOutputFormatter OutputFormatter {
get;

7
src/Libraries/NRefactory/Project/Src/PrettyPrinter/VBNet/VBNetOutputVisitor.cs

@ -43,12 +43,10 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -43,12 +43,10 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
AbstractPrettyPrintOptions IOutputAstVisitor.Options {
get { return prettyPrintOptions; }
set { prettyPrintOptions = (VBNetPrettyPrintOptions)value; }
}
public VBNetPrettyPrintOptions Options {
get { return prettyPrintOptions; }
set { prettyPrintOptions = value; }
}
public IOutputFormatter OutputFormatter {
@ -1184,7 +1182,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1184,7 +1182,8 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
break;
}
if (declareDeclaration.TypeReference.IsNull) {
bool isVoid = declareDeclaration.TypeReference.IsNull || declareDeclaration.TypeReference.SystemType == "System.Void";
if (isVoid) {
outputFormatter.PrintToken(Tokens.Sub);
} else {
outputFormatter.PrintToken(Tokens.Function);
@ -1210,7 +1209,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter @@ -1210,7 +1209,7 @@ namespace ICSharpCode.NRefactory.PrettyPrinter
AppendCommaSeparatedList(declareDeclaration.Parameters);
outputFormatter.PrintToken(Tokens.CloseParenthesis);
if (!declareDeclaration.TypeReference.IsNull) {
if (!isVoid) {
outputFormatter.Space();
outputFormatter.PrintToken(Tokens.As);
outputFormatter.Space();

1
src/Libraries/NRefactory/Project/Src/Visitors/ToCSharpConvertVisitor.cs

@ -19,6 +19,7 @@ namespace ICSharpCode.NRefactory.Visitors @@ -19,6 +19,7 @@ namespace ICSharpCode.NRefactory.Visitors
{
// The following conversions are implemented:
// Public Event EventName(param As String) -> automatic delegate declaration
// static variables inside methods become fields
public override object VisitEventDeclaration(EventDeclaration eventDeclaration, object data)
{

9
src/Libraries/NRefactory/Project/Src/Visitors/ToVBNetConvertVisitor.cs

@ -26,6 +26,7 @@ namespace ICSharpCode.NRefactory.Visitors @@ -26,6 +26,7 @@ namespace ICSharpCode.NRefactory.Visitors
// Simple event handler creation is replaced with AddressOfExpression
// Move Imports-statements out of namespaces
// Parenthesis around Cast expressions remove - these are syntax errors in VB.NET
// Decrease array creation size - VB specifies upper bound instead of array length
List<INode> nodesToMoveToCompilationUnit = new List<INode>();
@ -338,5 +339,13 @@ namespace ICSharpCode.NRefactory.Visitors @@ -338,5 +339,13 @@ namespace ICSharpCode.NRefactory.Visitors
}
return null;
}
public override object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
{
for (int i = 0; i < arrayCreateExpression.Arguments.Count; i++) {
arrayCreateExpression.Arguments[i] = Expression.AddInteger(arrayCreateExpression.Arguments[i], -1);
}
return base.VisitArrayCreateExpression(arrayCreateExpression, data);
}
}
}

17
src/Libraries/NRefactory/Project/Src/Visitors/VBNetConstructsConvertVisitor.cs

@ -26,6 +26,7 @@ namespace ICSharpCode.NRefactory.Visitors @@ -26,6 +26,7 @@ namespace ICSharpCode.NRefactory.Visitors
// IIF(cond, true, false) => ConditionalExpression
// Built-in methods => Prefix with class name
// Function A() \n A = SomeValue \n End Function -> convert to return statement
// Array creation => add 1 to upper bound to get array length
// Comparison with empty string literal ->
Dictionary<string, string> usings;
@ -133,6 +134,11 @@ namespace ICSharpCode.NRefactory.Visitors @@ -133,6 +134,11 @@ namespace ICSharpCode.NRefactory.Visitors
if ((method.Modifier & Modifiers.Visibility) == 0)
method.Modifier |= Modifiers.Public;
method.Modifier |= Modifiers.Extern | Modifiers.Static;
if (method.TypeReference.IsNull) {
method.TypeReference = new TypeReference("System.Void");
}
Attribute att = new Attribute("DllImport", null, null);
att.PositionalArguments.Add(CreateStringLiteral(declareDeclaration.Library));
if (declareDeclaration.Alias.Length > 0) {
@ -439,6 +445,17 @@ namespace ICSharpCode.NRefactory.Visitors @@ -439,6 +445,17 @@ namespace ICSharpCode.NRefactory.Visitors
return base.VisitUsingStatement(usingStatement, data);
}
public override object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
{
for (int i = 0; i < arrayCreateExpression.Arguments.Count; i++) {
arrayCreateExpression.Arguments[i] = Expression.AddInteger(arrayCreateExpression.Arguments[i], 1);
}
if (arrayCreateExpression.ArrayInitializer.CreateExpressions.Count == 0) {
arrayCreateExpression.ArrayInitializer = null;
}
return base.VisitArrayCreateExpression(arrayCreateExpression, data);
}
bool IsEmptyStringLiteral(Expression expression)
{
PrimitiveExpression pe = expression as PrimitiveExpression;

22
src/Libraries/NRefactory/Test/Output/CSharp/VBToCSharpConverterTest.cs

@ -231,6 +231,15 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter @@ -231,6 +231,15 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
"public static extern int MessageBox(IntPtr hwnd, string t, string caption, UInt32 t2);");
}
[Test]
public void PInvokeSub()
{
TestMember("Private Declare Sub Sleep Lib \"kernel32\" (ByVal dwMilliseconds As Long)",
"[DllImport(\"kernel32\", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]\n" +
"private static extern void Sleep(long dwMilliseconds);",
"System.Runtime.InteropServices");
}
[Test]
public void Constructor()
{
@ -612,5 +621,18 @@ static int static_Test2_j = 0;"); @@ -612,5 +621,18 @@ static int static_Test2_j = 0;");
TestStatement("If \"\" = a Then Return", "if (string.IsNullOrEmpty(a)) return; ");
TestStatement("If \"\" <> a Then Return", "if (!string.IsNullOrEmpty(a)) return; ");
}
[Test]
public void ArrayCreationUpperBound()
{
TestStatement("Dim i As String() = New String(1) {}",
"string[] i = new string[2];");
TestStatement("Dim i(1) As String",
"string[] i = new string[2];");
TestStatement("Dim i As String() = New String(1) {\"0\", \"1\"}",
"string[] i = new string[2] { \"0\", \"1\" };");
TestStatement("Dim i As String(,) = New String(5, 5) {}",
"string[,] i = new string[6, 6];");
}
}
}

19
src/Libraries/NRefactory/Test/Output/VBNet/CSharpToVBConverterTest.cs

@ -265,6 +265,14 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter @@ -265,6 +265,14 @@ namespace ICSharpCode.NRefactory.Tests.PrettyPrinter
"Public Declare Auto Function SendMessage Lib \"user32.dll\" Alias \"SendMessageW\" (ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As UIntPtr, ByVal lParam As IntPtr) As IntPtr");
}
[Test]
public void PInvokeSub()
{
TestMember("[DllImport(\"kernel32\", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]\n" +
"private static extern void Sleep(long dwMilliseconds);",
"Private Declare Ansi Sub Sleep Lib \"kernel32\" (ByVal dwMilliseconds As Long)");
}
[Test]
public void Constructor()
{
@ -460,5 +468,16 @@ End Class @@ -460,5 +468,16 @@ End Class
"\tM(V__2, v__1)\n" +
"End Sub");
}
[Test]
public void ArrayCreationUpperBound()
{
TestStatement("string[] i = new string[2];",
"Dim i As String() = New String(1) {}");
TestStatement("string[] i = new string[2] { \"0\", \"1\" };",
"Dim i As String() = New String(1) {\"0\", \"1\"}");
TestStatement("string[,] i = new string[6, 6];",
"Dim i As String(,) = New String(5, 5) {}");
}
}
}

6
src/Libraries/NRefactory/Test/Parser/Statements/LocalVariableDeclarationTests.cs

@ -234,7 +234,7 @@ namespace ICSharpCode.NRefactory.Tests.Ast @@ -234,7 +234,7 @@ namespace ICSharpCode.NRefactory.Tests.Ast
ArrayCreateExpression ace = (ArrayCreateExpression)lvd.Variables[0].Initializer;
Assert.AreEqual(new int[] { 0 } , ace.CreateType.RankSpecifier);
Assert.AreEqual(1, ace.Arguments.Count);
Assert.AreEqual(11, ((PrimitiveExpression)ace.Arguments[0]).Value);
Assert.AreEqual(10, ((PrimitiveExpression)ace.Arguments[0]).Value);
}
[Test]
@ -250,7 +250,7 @@ namespace ICSharpCode.NRefactory.Tests.Ast @@ -250,7 +250,7 @@ namespace ICSharpCode.NRefactory.Tests.Ast
ArrayCreateExpression ace = (ArrayCreateExpression)lvd.Variables[0].Initializer;
Assert.AreEqual(new int[] { 0 } , ace.CreateType.RankSpecifier);
Assert.AreEqual(1, ace.Arguments.Count);
Assert.AreEqual(11, ((PrimitiveExpression)ace.Arguments[0]).Value);
Assert.AreEqual(10, ((PrimitiveExpression)ace.Arguments[0]).Value);
}
[Test]
@ -276,7 +276,7 @@ namespace ICSharpCode.NRefactory.Tests.Ast @@ -276,7 +276,7 @@ namespace ICSharpCode.NRefactory.Tests.Ast
ArrayCreateExpression ace = (ArrayCreateExpression)lvd.Variables[0].Initializer;
Assert.AreEqual(new int[] {0, 0}, ace.CreateType.RankSpecifier);
Assert.AreEqual(1, ace.Arguments.Count);
Assert.AreEqual(11, ((PrimitiveExpression)ace.Arguments[0]).Value);
Assert.AreEqual(10, ((PrimitiveExpression)ace.Arguments[0]).Value);
}
[Test]

32
src/Main/Base/Project/Src/Services/AmbienceService/AmbienceService.cs

@ -8,13 +8,22 @@ @@ -8,13 +8,22 @@
using System;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Dom.Refactoring;
using ICSharpCode.NRefactory.PrettyPrinter;
namespace ICSharpCode.SharpDevelop
{
public static class AmbienceService
{
static readonly string ambienceProperty = "SharpDevelop.UI.CurrentAmbience";
static readonly string codeGenerationProperty = "SharpDevelop.UI.CodeGenerationOptions";
const string ambienceProperty = "SharpDevelop.UI.CurrentAmbience";
const string codeGenerationProperty = "SharpDevelop.UI.CodeGenerationOptions";
const string textEditorProperty = "ICSharpCode.TextEditor.Document.Document.DefaultDocumentAggregatorProperties";
static AmbienceService()
{
PropertyService.PropertyChanged += new PropertyChangedEventHandler(PropertyChanged);
ApplyCodeGenerationPropertiesToNRefactory();
}
public static Properties CodeGenerationProperties {
get {
@ -22,6 +31,16 @@ namespace ICSharpCode.SharpDevelop @@ -22,6 +31,16 @@ namespace ICSharpCode.SharpDevelop
}
}
static void ApplyCodeGenerationPropertiesToNRefactory()
{
Properties p = CodeGenerationProperties;
LanguageProperties.CSharp.CodeGenerator.Options.EmptyLinesBetweenMembers = p.Get("BlankLinesBetweenMembers", true);
LanguageProperties.CSharp.CodeGenerator.Options.BracesOnSameLine = p.Get("StartBlockOnSameLine", true);
System.CodeDom.Compiler.CodeGeneratorOptions cdo = new CodeDOMGeneratorUtility().CreateCodeGeneratorOptions;
LanguageProperties.CSharp.CodeGenerator.Options.IndentString = cdo.IndentString;
}
public static bool GenerateDocumentComments {
get {
return CodeGenerationProperties.Get("GenerateDocumentComments", true);
@ -90,14 +109,11 @@ namespace ICSharpCode.SharpDevelop @@ -90,14 +109,11 @@ namespace ICSharpCode.SharpDevelop
defaultAmbience = null;
OnAmbienceChanged(EventArgs.Empty);
}
if (e.Key == codeGenerationProperty || e.Key == textEditorProperty) {
ApplyCodeGenerationPropertiesToNRefactory();
}
}
static AmbienceService()
{
PropertyService.PropertyChanged += new PropertyChangedEventHandler(PropertyChanged);
}
static void OnAmbienceChanged(EventArgs e)
{
if (AmbienceChanged != null) {

3
src/Main/ICSharpCode.SharpDevelop.Dom/Project/ICSharpCode.SharpDevelop.Dom.csproj

@ -93,6 +93,7 @@ @@ -93,6 +93,7 @@
<Compile Include="Src\NRefactoryResolver\NRefactoryResolver.cs" />
<Compile Include="Src\NRefactoryResolver\TypeVisitor.cs" />
<Compile Include="Src\NRefactoryResolver\VBNetToCSharpConvertVisitor.cs" />
<Compile Include="Src\Refactoring\CodeGeneratorOptions.cs" />
<Compile Include="Src\ReflectionLayer\DomPersistence.cs" />
<Compile Include="Src\ReflectionLayer\ReflectionClass.cs" />
<Compile Include="Src\ReflectionLayer\ReflectionEvent.cs" />
@ -173,4 +174,4 @@ @@ -173,4 +174,4 @@
<Folder Include="Src\VBNet" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>
</Project>

17
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Refactoring/CodeGenerator.cs

@ -243,6 +243,12 @@ namespace ICSharpCode.SharpDevelop.Dom.Refactoring @@ -243,6 +243,12 @@ namespace ICSharpCode.SharpDevelop.Dom.Refactoring
}
#endregion
readonly CodeGeneratorOptions options = new CodeGeneratorOptions();
public CodeGeneratorOptions Options {
get { return options; }
}
#region Code generation / insertion
public virtual void InsertCodeAfter(IMember member, IDocument document, params AbstractNode[] nodes)
{
@ -258,13 +264,13 @@ namespace ICSharpCode.SharpDevelop.Dom.Refactoring @@ -258,13 +264,13 @@ namespace ICSharpCode.SharpDevelop.Dom.Refactoring
public virtual void InsertCodeAtEnd(DomRegion region, IDocument document, params AbstractNode[] nodes)
{
InsertCodeAfter(region.EndLine - 1, document,
GetIndentation(document, region.BeginLine) + '\t', nodes);
GetIndentation(document, region.BeginLine) + options.IndentString, nodes);
}
public virtual void InsertCodeInClass(IClass c, IDocument document, int targetLine, params AbstractNode[] nodes)
{
InsertCodeAfter(targetLine, document,
GetIndentation(document, c.Region.BeginLine) + '\t', false, nodes);
GetIndentation(document, c.Region.BeginLine) + options.IndentString, false, nodes);
}
protected string GetIndentation(IDocument document, int line)
@ -291,8 +297,11 @@ namespace ICSharpCode.SharpDevelop.Dom.Refactoring @@ -291,8 +297,11 @@ namespace ICSharpCode.SharpDevelop.Dom.Refactoring
IDocumentLine lineSegment = document.GetLine(insertLine + 1);
StringBuilder b = new StringBuilder();
for (int i = 0; i < nodes.Length; i++) {
if (startWithEmptyLine || i > 0)
b.AppendLine(indentation);
if (options.EmptyLinesBetweenMembers) {
if (startWithEmptyLine || i > 0) {
b.AppendLine(indentation);
}
}
b.Append(GenerateCode(nodes[i], indentation));
}
document.Insert(lineSegment.Offset, b.ToString());

28
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Refactoring/CodeGeneratorOptions.cs

@ -0,0 +1,28 @@ @@ -0,0 +1,28 @@
// <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.SharpDevelop.Dom.Refactoring
{
public class CodeGeneratorOptions
{
public bool BracesOnSameLine = true;
public bool EmptyLinesBetweenMembers = true;
string indentString;
public string IndentString {
get { return indentString; }
set {
if (string.IsNullOrEmpty(value)) {
throw new ArgumentNullException("value");
}
indentString = value;
}
}
}
}

37
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Refactoring/NRefactoryCodeGenerator.cs

@ -38,11 +38,31 @@ namespace ICSharpCode.SharpDevelop.Dom.Refactoring @@ -38,11 +38,31 @@ namespace ICSharpCode.SharpDevelop.Dom.Refactoring
public class CSharpCodeGenerator : NRefactoryCodeGenerator
{
public static readonly CSharpCodeGenerator Instance = new CSharpCodeGenerator();
internal static readonly CSharpCodeGenerator Instance = new CSharpCodeGenerator();
public override IOutputAstVisitor CreateOutputVisitor()
{
return new CSharpOutputVisitor();
CSharpOutputVisitor v = new CSharpOutputVisitor();
PrettyPrintOptions pOpt = v.Options;
BraceStyle braceStyle;
if (this.Options.BracesOnSameLine) {
braceStyle = BraceStyle.EndOfLine;
} else {
braceStyle = BraceStyle.NextLine;
}
pOpt.StatementBraceStyle = braceStyle;
pOpt.EventAddBraceStyle = braceStyle;
pOpt.EventRemoveBraceStyle = braceStyle;
pOpt.PropertyBraceStyle = braceStyle;
pOpt.PropertyGetBraceStyle = braceStyle;
pOpt.PropertySetBraceStyle = braceStyle;
pOpt.IndentationChar = this.Options.IndentString[0];
pOpt.IndentSize = this.Options.IndentString.Length;
pOpt.TabSize = this.Options.IndentString.Length;
return v;
}
/// <summary>
@ -100,17 +120,24 @@ namespace ICSharpCode.SharpDevelop.Dom.Refactoring @@ -100,17 +120,24 @@ namespace ICSharpCode.SharpDevelop.Dom.Refactoring
}
}
}
InsertCodeAfter(insertionLine, document, beginLineIndentation + '\t', nodes);
InsertCodeAfter(insertionLine, document, beginLineIndentation + this.Options.IndentString, nodes);
}
}
public class VBNetCodeGenerator : NRefactoryCodeGenerator
{
public static readonly VBNetCodeGenerator Instance = new VBNetCodeGenerator();
internal static readonly VBNetCodeGenerator Instance = new VBNetCodeGenerator();
public override IOutputAstVisitor CreateOutputVisitor()
{
return new VBNetOutputVisitor();
VBNetOutputVisitor v = new VBNetOutputVisitor();
VBNetPrettyPrintOptions pOpt = v.Options;
pOpt.IndentationChar = this.Options.IndentString[0];
pOpt.IndentSize = this.Options.IndentString.Length;
pOpt.TabSize = this.Options.IndentString.Length;
return v;
}
public override PropertyDeclaration CreateProperty(IField field, bool createGetter, bool createSetter)

4
src/Setup/Files.wxs

@ -621,6 +621,7 @@ @@ -621,6 +621,7 @@
<File Source="..\..\data\resources\StringResources.pt-br.resources" Name="STRIN_13.RES" Id="StringResources.pt_br.resources" LongName="StringResources.pt-br.resources" />
<File Source="..\..\data\resources\StringResources.ro.resources" Name="STRIN_14.RES" Id="StringResources.ro.resources" LongName="StringResources.ro.resources" />
<File Source="..\..\data\resources\StringResources.se.resources" Name="STRIN_15.RES" Id="StringResources.se.resources" LongName="StringResources.se.resources" />
<File Source="..\..\data\resources\StringResources.pt.resources" Name="STRIN_16.RES" Id="StringResources.pt.resources" LongName="StringResources.pt.resources" />
</Component>
</Directory>
<Directory Id="SchemasFolder" Name="schemas">
@ -730,6 +731,8 @@ @@ -730,6 +731,8 @@
<File Source="..\..\data\templates\project\CSharp\SharpDevelopMacro.xpt" Name="SHARPD_2.XPT" Id="CSharpSharpDevelopMacro.xpt" LongName="SharpDevelopMacro.xpt" />
<File Source="..\..\data\templates\project\CSharp\WebpageProject.xpt" Name="WEBPAG_1.XPT" Id="CSharpWebpageProject.xpt" LongName="WebpageProject.xpt" />
<File Source="..\..\data\templates\project\CSharp\WPFApplication.xpt" Name="WPFAPP_1.XPT" Id="CSharpWPFApplication.xpt" LongName="WPFApplication.xpt" />
<File Source="..\..\data\templates\project\CSharp\SharpDevelopCustomTool.xpt" Name="SHARPD_3.XPT" Id="SharpDevelopCustomTool.xpt" LongName="SharpDevelopCustomTool.xpt" />
<File Source="..\..\data\templates\project\CSharp\SharpDevelopCustomToolTemplate.xft.xml" Name="SHARPD_1.XML" Id="SharpDevelopCustomToolTemplate.xft.xml" LongName="SharpDevelopCustomToolTemplate.xft.xml" />
</Component>
<Component Guid="2EBDC2FE-A2C9-4023-BC86-0E688B5897A3" Id="CSharpNotifyIconProjectTemplate" DiskId="1">
<File Source="..\..\data\templates\project\CSharp\NotifyIcon.xpt" Name="NOTIFY.XPT" Id="NotifyIcon.xpt" LongName="NotifyIcon.xpt" />
@ -759,6 +762,7 @@ @@ -759,6 +762,7 @@
<File Source="..\..\data\templates\project\VBNet\Service.xpt" Name="Service.xpt" Id="VBNetService.xpt" />
<File Source="..\..\data\templates\project\VBNet\SharedAddin.xpt" Name="SHARED_1.XPT" Id="VBNetSharedAddin.xpt" LongName="SharedAddin.xpt" />
<File Source="..\..\data\templates\project\VBNet\SharpDevelopAddin.xpt" Name="SHARPD_4.XPT" Id="VBNetSharpDevelopAddin.xpt" LongName="SharpDevelopAddin.xpt" />
<File Source="..\..\data\templates\project\VBNet\CompactFormsProject.xpt" Name="COMPAC_1.XPT" Id="CompactFormsProject.xpt" LongName="CompactFormsProject.xpt" />
</Component>
</Directory>
<Component Guid="73EAC135-57B6-46C0-9F24-70A347B9AAC8" Id="ExampleProjectTemplate" DiskId="1">

Loading…
Cancel
Save