Browse Source

Merge branch 'newNR' of github.com:icsharpcode/SharpDevelop into newNR

pull/59/merge
Peter Forstmeier 12 years ago
parent
commit
5ff5dae00b
  1. 84
      SharpDevelop.Tests.sln
  2. 66
      data/resources/StringResources.it.resx
  3. 6
      data/resources/StringResources.nl.resx
  4. 6
      data/resources/StringResources.resx
  5. 4
      src/AddIns/Analysis/CodeQuality/Gui/Commands/AnalyzeCodeQualityCommand.cs
  6. 3
      src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/ProfilerProcessRunner.cs
  7. 3
      src/AddIns/Analysis/UnitTesting/Interfaces/IUnitTestTaskService.cs
  8. 3
      src/AddIns/Analysis/UnitTesting/Interfaces/UnitTestTaskService.cs
  9. 3
      src/AddIns/Analysis/UnitTesting/Service/ITestService.cs
  10. 3
      src/AddIns/Analysis/UnitTesting/Service/SDTestService.cs
  11. 6
      src/AddIns/Analysis/UnitTesting/TestRunner/TestExecutionManager.cs
  12. 1
      src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin
  13. 1
      src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj
  14. 5
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpInsightItem.cs
  15. 4
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs
  16. 62
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/ConvertInterfaceToAbstractClassContextAction.cs
  17. 4
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/CreatePropertiesDialog.xaml.cs
  18. 2
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/OverrideEqualsGetHashCodeMethodsDialog.xaml.cs
  19. 15
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/PropertyOrFieldWrapper.cs
  20. 11
      src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.addin
  21. 38
      src/AddIns/Debugger/Debugger.AddIn/Pads/ClassBrowserSupport.cs
  22. 12
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/DocumentPrinter.cs
  23. 8
      src/AddIns/Misc/AddInManager2/Project/Src/View/AddInsView.xaml
  24. 6
      src/AddIns/Misc/AddInManager2/Project/Src/ViewModel/AddInPackageViewModelBase.cs
  25. 20
      src/AddIns/Misc/AddInManager2/Project/Src/ViewModel/AddInsViewModelBase.cs
  26. 2
      src/AddIns/Misc/AddInManager2/Project/Src/ViewModel/NuGetAddInsViewModelBase.cs
  27. 2
      src/AddIns/Misc/PackageManagement/Project/Src/Design/FakePackageManagementProjectService.cs
  28. 2
      src/AddIns/Misc/PackageManagement/Project/Src/PackageManagementWorkbench.cs
  29. 4
      src/AddIns/Misc/PackageManagement/Project/Src/ServiceWithWorkbenchOwner.cs
  30. 2
      src/AddIns/Misc/PackageManagement/Test/Src/Helpers/ProjectHelper.cs
  31. 4
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/Commands/FormsCommand.cs
  32. 5
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/Commands/PreviewCommands.cs
  33. 9
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportExplorer/ReportExplorerPad.cs
  34. 15
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/BaseSettingsPanel.cs
  35. 24
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/Wizard/AbstractOptionPanel.cs
  36. 5
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/Services/UIService.cs
  37. 2
      src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/Toolbox/ToolboxProvider.cs
  38. 14
      src/AddIns/Misc/SearchAndReplace/Project/Gui/SearchResultNode.cs
  39. 6
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Highlighting/HtmlClipboardTests.cs
  40. 36
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Utils/CompressingTreeListTests.cs
  41. 69
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentTextWriter.cs
  42. 4
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/NewLineFinder.cs
  43. 4
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/OffsetChangeMap.cs
  44. 1
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocumentWeakEventManager.cs
  45. 106
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedInlineBuilder.cs
  46. 84
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedLine.cs
  47. 26
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingBrush.cs
  48. 78
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColor.cs
  49. 11
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColorizer.cs
  50. 103
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlClipboard.cs
  51. 62
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlOptions.cs
  52. 236
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlRichTextWriter.cs
  53. 252
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/RichText.cs
  54. 39
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/RichTextColorizer.cs
  55. 268
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/RichTextModel.cs
  56. 115
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/RichTextModelWriter.cs
  57. 9
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj
  58. 1
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/SearchPanel.cs
  59. 22
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/CompressingTreeList.cs
  60. 125
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/PlainRichTextWriter.cs
  61. 106
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/RichTextWriter.cs
  62. 439
      src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Xml/TagMatchingHeuristics.cs
  63. 7
      src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs
  64. 3
      src/Libraries/NRefactory/ICSharpCode.NRefactory/Properties/GlobalAssemblyInfo.cs
  65. 19
      src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractFreezable.cs
  66. 6
      src/Libraries/SharpTreeView/ICSharpCode.TreeView/SharpTreeView.cs
  67. 27
      src/Main/Base/Project/Dom/ClassBrowser/AssemblyLoadErrorTreeNode.cs
  68. 11
      src/Main/Base/Project/Dom/ClassBrowser/AssemblyTreeNode.cs
  69. 2
      src/Main/Base/Project/Dom/ClassBrowser/IClassBrowser.cs
  70. 4
      src/Main/Base/Project/Dom/ClassBrowser/TypeDefinitionTreeNode.cs
  71. 39
      src/Main/Base/Project/Dom/IModelCollection.cs
  72. 52
      src/Main/Base/Project/Dom/ModelCollectionChangedEvent.cs
  73. 59
      src/Main/Base/Project/Dom/ModelFactoryExtensions.cs
  74. 30
      src/Main/Base/Project/Dom/SimpleModelCollection.cs
  75. 13
      src/Main/Base/Project/Dom/SynchronizedModelCollection.cs
  76. 35
      src/Main/Base/Project/Editor/Search/SearchResultMatch.cs
  77. 14
      src/Main/Base/Project/Editor/Search/SearchResultsPad.cs
  78. 12
      src/Main/Base/Project/ICSharpCode.SharpDevelop.addin
  79. 4
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  80. 9
      src/Main/Base/Project/Project/Build/BuildError.cs
  81. 4
      src/Main/Base/Project/Project/Build/IBuildFeedbackSink.cs
  82. 5
      src/Main/Base/Project/Services/SD.cs
  83. 35
      src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs
  84. 34
      src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/MessageViewCategory.cs
  85. 5
      src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/MessageViewCategoryTextWriter.cs
  86. 2
      src/Main/Base/Project/Src/Project/AbstractProject.cs
  87. 5
      src/Main/Base/Project/Util/ProcessRunner.cs
  88. 5
      src/Main/Base/Project/Workbench/File/FileService.cs
  89. 69
      src/Main/Base/Project/Workbench/IOutputPad.cs
  90. 41
      src/Main/SharpDevelop/Dom/ClassBrowser/ClassBrowserPad.cs
  91. 43
      src/Main/SharpDevelop/Dom/ClassBrowser/Commands.cs
  92. 3
      src/Main/SharpDevelop/Dom/ClassBrowser/OpenFromGacDialog.xaml
  93. 2
      src/Main/SharpDevelop/Dom/ClassBrowser/OpenFromGacDialog.xaml.cs
  94. 19
      src/Main/SharpDevelop/Project/Build/BuildEngine.cs
  95. 2
      src/Main/SharpDevelop/Project/Build/BuildService.cs
  96. 9
      src/Main/SharpDevelop/Project/Build/UIBuildFeedbackSink.cs
  97. 2
      src/Main/SharpDevelop/Project/ProjectService.cs
  98. 2
      src/Main/SharpDevelop/Workbench/FileService.cs

84
SharpDevelop.Tests.sln

@ -1,10 +1,8 @@ @@ -1,10 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
# SharpDevelop 4.3
# SharpDevelop 5.0
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Main", "Main", "{256F5C28-532C-44C0-8AB8-D8EC5E492E01}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.BuildWorker35", "src\Main\ICSharpCode.SharpDevelop.BuildWorker35\ICSharpCode.SharpDevelop.BuildWorker35.csproj", "{B5F54272-49F0-40DB-845A-8D837875D3BA}"
EndProject
@ -27,8 +25,6 @@ EndProject @@ -27,8 +25,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpDevelop", "src\Main\SharpDevelop\SharpDevelop.csproj", "{1152B71B-3C05-4598-B20D-823B5D40559E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Libraries", "Libraries", "{2A232EF1-EB95-41C6-B63A-C106E0C95D3C}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil", "src\Libraries\cecil\Mono.Cecil.csproj", "{D68133BD-1E63-496E-9EDE-4FBDBF77B486}"
EndProject
@ -58,20 +54,14 @@ EndProject @@ -58,20 +54,14 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Decompiler", "src\Libraries\ICSharpCode.Decompiler\ICSharpCode.Decompiler.csproj", "{984CC812-9470-4A13-AFF9-CC44068D666C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{39327899-ED91-4F7F-988C-4FE4E17C014D}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Version Control", "Version Control", "{F208FF4F-E5D8-41D5-A7C7-B463976F156E}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitAddIn", "src\AddIns\VersionControl\GitAddIn\GitAddIn.csproj", "{83F15BA7-8478-4664-81BB-A82F146D88B3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubversionAddIn", "src\AddIns\VersionControl\SubversionAddIn\SubversionAddIn.csproj", "{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Language Bindings", "Language Bindings", "{E0646C25-36F2-4524-969F-FA621353AB94}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharpBinding", "src\AddIns\BackendBindings\CSharpBinding\Project\CSharpBinding.csproj", "{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A}"
EndProject
@ -100,8 +90,6 @@ EndProject @@ -100,8 +90,6 @@ EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VBBinding", "src\AddIns\BackendBindings\VBBinding\Project\VBBinding.vbproj", "{6D209CBB-D8C1-478A-BC30-D3FC87B7858F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{F3662720-9EA2-4591-BBC6-97361DCE50A9}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelpViewer", "src\AddIns\Misc\HelpViewer\HelpViewer.csproj", "{80F76D10-0B44-4D55-B4BD-DAEB5464090C}"
EndProject
@ -116,8 +104,6 @@ EndProject @@ -116,8 +104,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RegExpTk", "src\AddIns\Misc\RegExpTk\Project\RegExpTk.csproj", "{64A3E5E6-90BF-47F6-94DF-68C94B62C817}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UsageDataCollector", "UsageDataCollector", "{DEFC8584-BEC3-4921-BD0F-40482E450B7B}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UsageDataCollector", "src\AddIns\Misc\UsageDataCollector\UsageDataCollector\UsageDataCollector.csproj", "{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0}"
EndProject
@ -130,8 +116,6 @@ EndProject @@ -130,8 +116,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TextTemplating", "src\AddIns\Misc\TextTemplating\Project\TextTemplating.csproj", "{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PackageManagement", "PackageManagement", "{485A4CCF-55CF-49F4-BD6D-A22B788C67DA}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageManagement", "src\AddIns\Misc\PackageManagement\Project\PackageManagement.csproj", "{AE4AB0FA-6087-4480-AF37-0FA1452B3DA1}"
EndProject
@ -146,16 +130,12 @@ EndProject @@ -146,16 +130,12 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageManagement.Cmdlets.Tests", "src\AddIns\Misc\PackageManagement\Cmdlets\Test\PackageManagement.Cmdlets.Tests.csproj", "{11115C83-3DB1-431F-8B98-59040359238D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddInManager2", "AddInManager2", "{1F88F080-AD7C-4B03-9895-20C26282429D}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddInManager2", "src\AddIns\Misc\AddInManager2\Project\AddInManager2.csproj", "{60480C2F-F228-4D86-B98F-AF75A7DCEC34}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddInManager2.Tests", "src\AddIns\Misc\AddInManager2\AddInManager2.Tests\AddInManager2.Tests.csproj", "{0D0CB6E5-1EAD-471F-96B9-BFF84057BCF5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Reports", "Reports", "{FEDD3FD9-0480-43CC-913C-4E0876DDA852}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Reports.Addin", "src\AddIns\Misc\Reports\ICSharpCode.Reports.Addin\ICSharpCode.Reports.Addin.csproj", "{62033CC6-01CD-47A2-ADFD-188E9C524C0A}"
EndProject
@ -168,8 +148,6 @@ EndProject @@ -168,8 +148,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Irony", "src\AddIns\Misc\Reports\Irony\Irony.csproj", "{47B2D204-C993-4489-8B83-6DA7321CFAE0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Display Bindings", "Display Bindings", "{11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvalonEdit.AddIn", "src\AddIns\DisplayBindings\AvalonEdit.AddIn\AvalonEdit.AddIn.csproj", "{0162E499-42D0-409B-AA25-EED21F75336B}"
EndProject
@ -184,8 +162,6 @@ EndProject @@ -184,8 +162,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILSpyAddIn", "src\AddIns\DisplayBindings\ILSpyAddIn\ILSpyAddIn.csproj", "{8AA421C8-D7AF-4957-9F43-5135328ACB24}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Data", "Data", "{0F5192F2-0744-4BA9-A074-6BE82D111B8D}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Data.Addin", "src\AddIns\DisplayBindings\Data\ICSharpCode.Data.Addin\ICSharpCode.Data.Addin.csproj", "{A9F12710-24E4-46D4-832C-6ECB395B9EAD}"
EndProject
@ -200,8 +176,6 @@ EndProject @@ -200,8 +176,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Data.SQLServer", "src\AddIns\DisplayBindings\Data\ICSharpCode.Data.SQLServer\ICSharpCode.Data.SQLServer.csproj", "{AFE34868-AFA1-4E1C-9450-47AB4BE329D5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WpfDesign", "WpfDesign", "{83BAB756-1010-4A2F-9B9D-7F9EBCB288F5}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfDesign", "src\AddIns\DisplayBindings\WpfDesign\WpfDesign\Project\WpfDesign.csproj", "{66A378A1-E9F4-4AD5-8946-D0EC06C2902F}"
EndProject
@ -218,8 +192,6 @@ EndProject @@ -218,8 +192,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FormsDesigner", "src\AddIns\DisplayBindings\FormsDesigner\Project\FormsDesigner.csproj", "{9E951B9F-6AC2-4537-9D0B-0AE7C026D5A1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debugger", "Debugger", "{AF5E0DC1-1FA0-4346-A436-0C817C68F7C1}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.Core", "src\AddIns\Debugger\Debugger.Core\Debugger.Core.csproj", "{1D18D788-F7EE-4585-A23B-34DC8EC63CB8}"
EndProject
@ -228,8 +200,6 @@ EndProject @@ -228,8 +200,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Debugger.Tests", "src\AddIns\Debugger\Debugger.Tests\Debugger.Tests.csproj", "{A4C858C8-51B6-4265-A695-A20FCEBA1D19}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Analysis", "Analysis", "{B3352C08-3CB4-4DD9-996F-B9DCE4356BB9}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTesting", "src\AddIns\Analysis\UnitTesting\UnitTesting.csproj", "{1F261725-6318-4434-A1B1-6C70CE4CD324}"
EndProject
@ -250,8 +220,6 @@ EndProject @@ -250,8 +220,6 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeQuality", "src\AddIns\Analysis\CodeQuality\CodeQuality.csproj", "{0A029008-4973-4256-9150-9AF12845C547}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Profiler", "Profiler", "{7D16E1F9-0F9F-4A05-A162-A59C05E88B68}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Profiler.Tests", "src\AddIns\Analysis\Profiler\Tests\Profiler.Tests\Profiler.Tests.csproj", "{DAEA4E6C-02CD-47DA-806B-1FCE1E9675EC}"
EndProject
@ -637,14 +605,6 @@ Global @@ -637,14 +605,6 @@ Global
{0A029008-4973-4256-9150-9AF12845C547}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A029008-4973-4256-9150-9AF12845C547}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A029008-4973-4256-9150-9AF12845C547}.Release|Any CPU.Build.0 = Release|Any CPU
{E2FD63DA-8478-4066-934C-DA82A852C83A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E2FD63DA-8478-4066-934C-DA82A852C83A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E2FD63DA-8478-4066-934C-DA82A852C83A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E2FD63DA-8478-4066-934C-DA82A852C83A}.Release|Any CPU.Build.0 = Release|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Release|Any CPU.Build.0 = Release|Any CPU
{DAEA4E6C-02CD-47DA-806B-1FCE1E9675EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DAEA4E6C-02CD-47DA-806B-1FCE1E9675EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DAEA4E6C-02CD-47DA-806B-1FCE1E9675EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
@ -665,6 +625,14 @@ Global @@ -665,6 +625,14 @@ Global
{D7DB55CF-58F8-4164-A6C9-AE7456E5BEF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D7DB55CF-58F8-4164-A6C9-AE7456E5BEF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D7DB55CF-58F8-4164-A6C9-AE7456E5BEF3}.Release|Any CPU.Build.0 = Release|Any CPU
{E2FD63DA-8478-4066-934C-DA82A852C83A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E2FD63DA-8478-4066-934C-DA82A852C83A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E2FD63DA-8478-4066-934C-DA82A852C83A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E2FD63DA-8478-4066-934C-DA82A852C83A}.Release|Any CPU.Build.0 = Release|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DF4060F-5EE0-41CF-8096-F27355FD5511}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -683,24 +651,19 @@ Global @@ -683,24 +651,19 @@ Global
{D68133BD-1E63-496E-9EDE-4FBDBF77B486} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{6222A3A1-83CE-47A3-A4E4-A018F82D44D8} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{53DCA265-3C3C-42F9-B647-F72BA678122B} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{63D3B27A-D966-4902-90B3-30290E1692F1} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{2FF700C2-A38A-48BD-A637-8CAFD4FE6237} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{4139CCF6-FB49-4A9D-B2CF-331E9EA3198D} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{DDE2A481-8271-4EAC-A330-8FA6A38D13D1} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{984CC812-9470-4A13-AFF9-CC44068D666C} = {2A232EF1-EB95-41C6-B63A-C106E0C95D3C}
{3B2A5653-EC97-4001-BB9B-D90F1AF2C371} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{53DCA265-3C3C-42F9-B647-F72BA678122B} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{63D3B27A-D966-4902-90B3-30290E1692F1} = {E5A0F4D8-37FD-4A30-BEB0-4409DC4E0865}
{F208FF4F-E5D8-41D5-A7C7-B463976F156E} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{E0646C25-36F2-4524-969F-FA621353AB94} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{F3662720-9EA2-4591-BBC6-97361DCE50A9} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{AF5E0DC1-1FA0-4346-A436-0C817C68F7C1} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{B3352C08-3CB4-4DD9-996F-B9DCE4356BB9} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{E2FD63DA-8478-4066-934C-DA82A852C83A} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{83F15BA7-8478-4664-81BB-A82F146D88B3} = {F208FF4F-E5D8-41D5-A7C7-B463976F156E}
{17F4D7E0-6933-4C2E-8714-FD7E98D625D5} = {F208FF4F-E5D8-41D5-A7C7-B463976F156E}
{E0646C25-36F2-4524-969F-FA621353AB94} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{1F1AC7CD-D154-45BB-8EAF-804CA8055F5A} = {E0646C25-36F2-4524-969F-FA621353AB94}
{E954F3CB-A446-492F-A664-2B376EBC86E8} = {E0646C25-36F2-4524-969F-FA621353AB94}
{70966F84-74C9-4067-A379-0C674A929233} = {E0646C25-36F2-4524-969F-FA621353AB94}
@ -714,6 +677,7 @@ Global @@ -714,6 +677,7 @@ Global
{85C09AD8-183B-403A-869A-7226646218A9} = {E0646C25-36F2-4524-969F-FA621353AB94}
{CAD4D128-5A67-444B-88AE-37E0AF79C57E} = {E0646C25-36F2-4524-969F-FA621353AB94}
{6D209CBB-D8C1-478A-BC30-D3FC87B7858F} = {E0646C25-36F2-4524-969F-FA621353AB94}
{F3662720-9EA2-4591-BBC6-97361DCE50A9} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{80F76D10-0B44-4D55-B4BD-DAEB5464090C} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{9196DD8A-B4D4-4780-8742-C5762E547FC2} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{7D5C266F-D6FF-4D14-B315-0C0FC6C4EF51} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
@ -721,27 +685,28 @@ Global @@ -721,27 +685,28 @@ Global
{D022A6CE-7438-41E8-AC64-F2DE18EC54C6} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{64A3E5E6-90BF-47F6-94DF-68C94B62C817} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{DEFC8584-BEC3-4921-BD0F-40482E450B7B} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0} = {DEFC8584-BEC3-4921-BD0F-40482E450B7B}
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6} = {DEFC8584-BEC3-4921-BD0F-40482E450B7B}
{A569DCC1-C608-45FD-B770-4F79335EF154} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{5186325C-DD7F-4246-9BE7-3F384EFBF5A6} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{B5D8C3E6-42EC-4D4B-AD05-3644B32563EF} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{485A4CCF-55CF-49F4-BD6D-A22B788C67DA} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{1F88F080-AD7C-4B03-9895-20C26282429D} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{FEDD3FD9-0480-43CC-913C-4E0876DDA852} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{6B1CFE35-DA17-4DEB-9C6E-227E5E251DA0} = {DEFC8584-BEC3-4921-BD0F-40482E450B7B}
{0008FCE9-9EB4-4E2E-979B-553278E5BBA6} = {DEFC8584-BEC3-4921-BD0F-40482E450B7B}
{AE4AB0FA-6087-4480-AF37-0FA1452B3DA1} = {485A4CCF-55CF-49F4-BD6D-A22B788C67DA}
{A406803B-C584-43A3-BCEE-A0BB3132CB5F} = {485A4CCF-55CF-49F4-BD6D-A22B788C67DA}
{C3F15E22-5793-4129-AF8C-6229112B86D2} = {485A4CCF-55CF-49F4-BD6D-A22B788C67DA}
{56E98A01-8398-4A08-9578-C7337711A52B} = {485A4CCF-55CF-49F4-BD6D-A22B788C67DA}
{E0A5E80A-003B-4335-A9DC-A76E2E46D38D} = {485A4CCF-55CF-49F4-BD6D-A22B788C67DA}
{11115C83-3DB1-431F-8B98-59040359238D} = {485A4CCF-55CF-49F4-BD6D-A22B788C67DA}
{1F88F080-AD7C-4B03-9895-20C26282429D} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{60480C2F-F228-4D86-B98F-AF75A7DCEC34} = {1F88F080-AD7C-4B03-9895-20C26282429D}
{0D0CB6E5-1EAD-471F-96B9-BFF84057BCF5} = {1F88F080-AD7C-4B03-9895-20C26282429D}
{FEDD3FD9-0480-43CC-913C-4E0876DDA852} = {F3662720-9EA2-4591-BBC6-97361DCE50A9}
{62033CC6-01CD-47A2-ADFD-188E9C524C0A} = {FEDD3FD9-0480-43CC-913C-4E0876DDA852}
{2EE63FDD-7F49-40BD-8A2E-240848B9FA83} = {FEDD3FD9-0480-43CC-913C-4E0876DDA852}
{0884566C-E013-4185-B223-47547AA75167} = {FEDD3FD9-0480-43CC-913C-4E0876DDA852}
{1491E558-9C19-4EAC-9406-868AB8181F38} = {FEDD3FD9-0480-43CC-913C-4E0876DDA852}
{47B2D204-C993-4489-8B83-6DA7321CFAE0} = {FEDD3FD9-0480-43CC-913C-4E0876DDA852}
{11BF9245-88A3-4A0A-9A8A-EC9D98036B0F} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{0162E499-42D0-409B-AA25-EED21F75336B} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{E618A9CD-A39F-4925-A538-E8A3FEF24E54} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{DCA2703D-250A-463E-A68A-07ED105AE6BD} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
@ -749,23 +714,25 @@ Global @@ -749,23 +714,25 @@ Global
{DFB936AD-90EE-4B4F-941E-4F4A636F0D92} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{8AA421C8-D7AF-4957-9F43-5135328ACB24} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{0F5192F2-0744-4BA9-A074-6BE82D111B8D} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{83BAB756-1010-4A2F-9B9D-7F9EBCB288F5} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{85226AFB-CE71-4851-9A75-7EEC663A8E8A} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{9E951B9F-6AC2-4537-9D0B-0AE7C026D5A1} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{A9F12710-24E4-46D4-832C-6ECB395B9EAD} = {0F5192F2-0744-4BA9-A074-6BE82D111B8D}
{B7823AE9-4B43-4859-8796-2EBDC116FBB8} = {0F5192F2-0744-4BA9-A074-6BE82D111B8D}
{BAD94D6E-4159-4CB6-B991-486F412D9BB6} = {0F5192F2-0744-4BA9-A074-6BE82D111B8D}
{5C70D6AB-0A33-43F9-B8B5-54558C35BBB1} = {0F5192F2-0744-4BA9-A074-6BE82D111B8D}
{EEF5E054-4192-4A57-8FBF-E860D808A51D} = {0F5192F2-0744-4BA9-A074-6BE82D111B8D}
{AFE34868-AFA1-4E1C-9450-47AB4BE329D5} = {0F5192F2-0744-4BA9-A074-6BE82D111B8D}
{83BAB756-1010-4A2F-9B9D-7F9EBCB288F5} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{66A378A1-E9F4-4AD5-8946-D0EC06C2902F} = {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5}
{9A9D6FD4-6A2E-455D-ACC3-DDA775FE9865} = {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5}
{943DBBB3-E84E-4CF4-917C-C05AFA8743C1} = {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5}
{78CC29AC-CC79-4355-B1F2-97936DF198AC} = {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5}
{88DA149F-21B2-48AB-82C4-28FB6BDFD783} = {83BAB756-1010-4A2F-9B9D-7F9EBCB288F5}
{85226AFB-CE71-4851-9A75-7EEC663A8E8A} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{9E951B9F-6AC2-4537-9D0B-0AE7C026D5A1} = {11BF9245-88A3-4A0A-9A8A-EC9D98036B0F}
{AF5E0DC1-1FA0-4346-A436-0C817C68F7C1} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {AF5E0DC1-1FA0-4346-A436-0C817C68F7C1}
{EC06F96A-AEEC-49D6-B03D-AB87C6EB674C} = {AF5E0DC1-1FA0-4346-A436-0C817C68F7C1}
{A4C858C8-51B6-4265-A695-A20FCEBA1D19} = {AF5E0DC1-1FA0-4346-A436-0C817C68F7C1}
{B3352C08-3CB4-4DD9-996F-B9DCE4356BB9} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
{1F261725-6318-4434-A1B1-6C70CE4CD324} = {B3352C08-3CB4-4DD9-996F-B9DCE4356BB9}
{44A8DE09-CAB9-49D8-9CFC-5EB0A552F181} = {B3352C08-3CB4-4DD9-996F-B9DCE4356BB9}
{3EAA45A9-735C-4AC7-A799-947B93EA449D} = {B3352C08-3CB4-4DD9-996F-B9DCE4356BB9}
@ -781,5 +748,6 @@ Global @@ -781,5 +748,6 @@ Global
{CEFF8221-95D8-4F60-9D14-687019D0B2E8} = {7D16E1F9-0F9F-4A05-A162-A59C05E88B68}
{BD38E43B-947F-474B-8F6C-8BDAA9EE99A6} = {7D16E1F9-0F9F-4A05-A162-A59C05E88B68}
{D7DB55CF-58F8-4164-A6C9-AE7456E5BEF3} = {7D16E1F9-0F9F-4A05-A162-A59C05E88B68}
{E2FD63DA-8478-4066-934C-DA82A852C83A} = {39327899-ED91-4F7F-988C-4FE4E17C014D}
EndGlobalSection
EndGlobal

66
data/resources/StringResources.it.resx

@ -229,6 +229,69 @@ Scaricare un componente da internet, poi cliccare 'Install AddIn' e selezionare @@ -229,6 +229,69 @@ Scaricare un componente da internet, poi cliccare 'Install AddIn' e selezionare
<data name="AddInManager.UnknownFileFormat" xml:space="preserve">
<value>Formato file sconosciuto:</value>
</data>
<data name="AddInManager2.AddInsView.InstallFromArchive" xml:space="preserve">
<value>Installa da archivio...</value>
</data>
<data name="AddInManager2.AddInsView.Repository" xml:space="preserve">
<value>Repository:</value>
</data>
<data name="AddInManager2.AddInsView.Search" xml:space="preserve">
<value>Cerca:</value>
</data>
<data name="AddInManager2.Details.CreatedBy" xml:space="preserve">
<value>Creato da:</value>
</data>
<data name="AddInManager2.Details.Dependencies" xml:space="preserve">
<value>Dipendenze:</value>
</data>
<data name="AddInManager2.Details.FileName" xml:space="preserve">
<value>Nome file:</value>
</data>
<data name="AddInManager2.Details.InstalledVersion" xml:space="preserve">
<value>Versione installata:</value>
</data>
<data name="AddInManager2.Details.MoreInformation" xml:space="preserve">
<value>Più informazioni</value>
</data>
<data name="AddInManager2.Details.NewVersion" xml:space="preserve">
<value>Nuova versione:</value>
</data>
<data name="AddInManager2.Details.Version" xml:space="preserve">
<value>Versione:</value>
</data>
<data name="AddInManager2.Details.ViewLicenseTerms" xml:space="preserve">
<value>Mostra i Termini di Licenza</value>
</data>
<data name="AddInManager2.LicenseAcceptance.AcceptButton" xml:space="preserve">
<value>&amp;Accetto</value>
</data>
<data name="AddInManager2.LicenseAcceptance.DeclineButton" xml:space="preserve">
<value>&amp;Rifiuto</value>
</data>
<data name="AddInManager2.OptionPanel.Add" xml:space="preserve">
<value>Aggiungi</value>
</data>
<data name="AddInManager2.OptionPanel.Name" xml:space="preserve">
<value>Nome:</value>
</data>
<data name="AddInManager2.OptionPanel.Remove" xml:space="preserve">
<value>Elimina</value>
</data>
<data name="AddInManager2.OptionPanel.Source" xml:space="preserve">
<value>Sorgente:</value>
</data>
<data name="AddInManager2.OptionPanel.Tree.Repositories" xml:space="preserve">
<value>Repositories</value>
</data>
<data name="AddInManager2.Views.Available" xml:space="preserve">
<value>Disponibile</value>
</data>
<data name="AddInManager2.Views.Installed" xml:space="preserve">
<value>Installato</value>
</data>
<data name="AddInManager2.Views.Updates" xml:space="preserve">
<value>Aggiornamenti</value>
</data>
<data name="AddIns.AvalonEdit.InconsistentNewlines.Description" xml:space="preserve">
<value>Questo file contiene dei ritorni a capo inconsistenti.</value>
</data>
@ -5760,6 +5823,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension< @@ -5760,6 +5823,9 @@ Microsoft.Tools.WindowsInstallerXml.Extensions.NetFxCompiler, WixNetFxExtension<
<data name="ResourceEditor.ResourceEdit.ContextMenu.CopyResourceName" xml:space="preserve">
<value>Copia nome risorsa</value>
</data>
<data name="ResourceEditor.ResourceEdit.ContextMenu.EditComment" xml:space="preserve">
<value>Modifica descrizione</value>
</data>
<data name="ResourceEditor.ResourceEdit.ContextMenu.Rename" xml:space="preserve">
<value>&amp;Rinomina</value>
</data>

6
data/resources/StringResources.nl.resx

@ -358,6 +358,12 @@ Deze stoppen met werken na verwijderen van deze AddIn.</value> @@ -358,6 +358,12 @@ Deze stoppen met werken na verwijderen van deze AddIn.</value>
<data name="AddInManager2.SDAddInFileFilter" xml:space="preserve">
<value>SharpDevelop AddIns|*.sdaddin;*.addin|Alle bestanden|*.*</value>
</data>
<data name="AddInManager2.UpdateNotifier.BubbleText" xml:space="preserve">
<value>Hier klikken om de updates te zien.</value>
</data>
<data name="AddInManager2.UpdateNotifier.BubbleTitle" xml:space="preserve">
<value>Er zijn updates voor SharpDevelop beschikbaar.</value>
</data>
<data name="AddInManager2.Views.Available" xml:space="preserve">
<value>Beschikbaar</value>
</data>

6
data/resources/StringResources.resx

@ -3910,6 +3910,12 @@ has been changed externally. Do you want to reload it?</value> @@ -3910,6 +3910,12 @@ has been changed externally. Do you want to reload it?</value>
<data name="ICSharpCode.SharpDevelop.DefaultEditor.IncrementalSearch.ReverseSearchStatusBarMessage" xml:space="preserve">
<value>Reverse Incremental Search:</value>
</data>
<data name="ICSharpCode.SharpDevelop.Dom.AssemblyInvalid" xml:space="preserve">
<value>{0} is not a valid .NET assembly.</value>
</data>
<data name="ICSharpCode.SharpDevelop.Dom.AssemblyNotAccessible" xml:space="preserve">
<value>{0} is not accessible or doesn't exist anymore.</value>
</data>
<data name="ICSharpCode.SharpDevelop.ErrorLoadingCodeCompletionInformation" xml:space="preserve">
<value>Error loading code-completion information for ${Assembly} from ${Filename}:</value>
</data>

4
src/AddIns/Analysis/CodeQuality/Gui/Commands/AnalyzeCodeQualityCommand.cs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
using System;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop;
namespace ICSharpCode.CodeQuality.Gui
{
@ -11,7 +11,7 @@ namespace ICSharpCode.CodeQuality.Gui @@ -11,7 +11,7 @@ namespace ICSharpCode.CodeQuality.Gui
{
public override void Run()
{
WorkbenchSingleton.Workbench.ShowView(new AnalyzeCodeQualityViewContent());
SD.Workbench.ShowView(new AnalyzeCodeQualityViewContent());
}
}
}

3
src/AddIns/Analysis/Profiler/Frontend/AddIn/Src/ProfilerProcessRunner.cs

@ -11,6 +11,7 @@ using ICSharpCode.Profiler.Controller; @@ -11,6 +11,7 @@ using ICSharpCode.Profiler.Controller;
using ICSharpCode.Profiler.Controller.Data;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Workbench;
namespace ICSharpCode.Profiler.AddIn
{
@ -39,7 +40,7 @@ namespace ICSharpCode.Profiler.AddIn @@ -39,7 +40,7 @@ namespace ICSharpCode.Profiler.AddIn
wasStarted = false;
}
public Task<int> RunInOutputPadAsync(MessageViewCategory outputCategory, string program, params string[] arguments)
public Task<int> RunInOutputPadAsync(IOutputCategory outputCategory, string program, params string[] arguments)
{
throw new NotImplementedException();
}

3
src/AddIns/Analysis/UnitTesting/Interfaces/IUnitTestTaskService.cs

@ -4,12 +4,13 @@ @@ -4,12 +4,13 @@
using System;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Workbench;
namespace ICSharpCode.UnitTesting
{
public interface IUnitTestTaskService
{
MessageViewCategory BuildMessageViewCategory { get; }
IOutputCategory BuildMessageViewCategory { get; }
void ClearExceptCommentTasks();
void Add(SDTask task);
bool SomethingWentWrong { get; }

3
src/AddIns/Analysis/UnitTesting/Interfaces/UnitTestTaskService.cs

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
using System;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Workbench;
namespace ICSharpCode.UnitTesting
{
@ -14,7 +15,7 @@ namespace ICSharpCode.UnitTesting @@ -14,7 +15,7 @@ namespace ICSharpCode.UnitTesting
TaskService.ClearExceptCommentTasks();
}
public MessageViewCategory BuildMessageViewCategory {
public IOutputCategory BuildMessageViewCategory {
get { return TaskService.BuildMessageViewCategory; }
}

3
src/AddIns/Analysis/UnitTesting/Service/ITestService.cs

@ -7,6 +7,7 @@ using System.Threading.Tasks; @@ -7,6 +7,7 @@ using System.Threading.Tasks;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Workbench;
namespace ICSharpCode.UnitTesting
{
@ -18,7 +19,7 @@ namespace ICSharpCode.UnitTesting @@ -18,7 +19,7 @@ namespace ICSharpCode.UnitTesting
/// </summary>
ITestFramework GetTestFrameworkForProject(IProject project);
MessageViewCategory UnitTestMessageView { get; }
IOutputCategory UnitTestMessageView { get; }
/// <summary>
/// Gets the current test solution.

3
src/AddIns/Analysis/UnitTesting/Service/SDTestService.cs

@ -8,6 +8,7 @@ using System.Threading.Tasks; @@ -8,6 +8,7 @@ using System.Threading.Tasks;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Workbench;
using ICSharpCode.UnitTesting.Frameworks;
namespace ICSharpCode.UnitTesting
@ -34,7 +35,7 @@ namespace ICSharpCode.UnitTesting @@ -34,7 +35,7 @@ namespace ICSharpCode.UnitTesting
#region UnitTestMessageView
MessageViewCategory unitTestMessageView;
public MessageViewCategory UnitTestMessageView {
public IOutputCategory UnitTestMessageView {
get {
if (unitTestMessageView == null) {
MessageViewCategory.Create(ref unitTestMessageView,

6
src/AddIns/Analysis/UnitTesting/TestRunner/TestExecutionManager.cs

@ -115,9 +115,9 @@ namespace ICSharpCode.UnitTesting.Frameworks @@ -115,9 +115,9 @@ namespace ICSharpCode.UnitTesting.Frameworks
void ClearTasks()
{
taskService.BuildMessageViewCategory.ClearText();
taskService.BuildMessageViewCategory.Clear();
taskService.ClearExceptCommentTasks();
testService.UnitTestMessageView.ClearText();
testService.UnitTestMessageView.Clear();
}
void ShowUnitTestsPad()
@ -132,7 +132,7 @@ namespace ICSharpCode.UnitTesting.Frameworks @@ -132,7 +132,7 @@ namespace ICSharpCode.UnitTesting.Frameworks
void ShowOutputPad()
{
workbench.GetPad(typeof(CompilerMessageView)).BringPadToFront();
testService.UnitTestMessageView.Activate(true);
}
void ResetTestResults()

1
src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin

@ -317,6 +317,7 @@ @@ -317,6 +317,7 @@
<Class class="CSharpBinding.Refactoring.MoveTypeToFileContextAction" />
<Class class="CSharpBinding.Refactoring.RenameFileToMatchTypeNameContextAction" />
<Class class="CSharpBinding.Refactoring.ParamRangeCheckContextAction" />
<Class class="CSharpBinding.Refactoring.ConvertInterfaceToAbstractClassContextAction" />
</Path>
<Path name = "/SharpDevelop/Workbench/DisplayBindings">

1
src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.csproj

@ -88,6 +88,7 @@ @@ -88,6 +88,7 @@
<Compile Include="Src\FormsDesigner\SecondaryDisplayBinding.cs" />
<Compile Include="Src\Parser\FoldingVisitor.cs" />
<Compile Include="Src\Refactoring\AbstractInlineRefactorDialog.cs" />
<Compile Include="Src\Refactoring\ConvertInterfaceToAbstractClassContextAction.cs" />
<Compile Include="Src\Refactoring\CreateProperties.cs" />
<Compile Include="Src\Refactoring\CreatePropertiesCommand.cs" />
<Compile Include="Src\Refactoring\CreatePropertiesDialog.xaml.cs">

5
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Completion/CSharpInsightItem.cs

@ -53,10 +53,11 @@ namespace CSharpBinding.Completion @@ -53,10 +53,11 @@ namespace CSharpBinding.Completion
var stringBuilder = new StringBuilder();
var formatter = new ParameterHighlightingOutputFormatter(stringBuilder, highlightedParameterIndex);
ambience.ConvertEntity(Method, formatter, FormattingOptionsFactory.CreateSharpDevelop());
var inlineBuilder = new HighlightedInlineBuilder(stringBuilder.ToString());
string code = stringBuilder.ToString();
var inlineBuilder = new RichTextModel();
inlineBuilder.SetFontWeight(formatter.parameterStartOffset, formatter.parameterLength, FontWeights.Bold);
header.Inlines.Clear();
header.Inlines.AddRange(inlineBuilder.CreateRuns());
header.Inlines.AddRange(new RichText(code, inlineBuilder).CreateRuns());
}
public object Content {

4
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/CSharpSymbolSearch.cs

@ -239,8 +239,8 @@ namespace CSharpBinding @@ -239,8 +239,8 @@ namespace CSharpBinding
{
internal readonly string newCode;
public RenameResultMatch(FileName fileName, TextLocation startLocation, TextLocation endLocation, int offset, int length, string newCode, HighlightedInlineBuilder builder = null, HighlightingColor defaultTextColor = null)
: base(fileName, startLocation, endLocation, offset, length, builder, defaultTextColor)
public RenameResultMatch(FileName fileName, TextLocation startLocation, TextLocation endLocation, int offset, int length, string newCode, RichText richText = null, HighlightingColor defaultTextColor = null)
: base(fileName, startLocation, endLocation, offset, length, richText, defaultTextColor)
{
this.newCode = newCode;
}

62
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/ConvertInterfaceToAbstractClassContextAction.cs

@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.NRefactory.CSharp.Refactoring;
using ICSharpCode.SharpDevelop.Refactoring;
using CSharpBinding.Parser;
namespace CSharpBinding.Refactoring
{
[ContextAction("Convert interface to abstract class", Description = "Converts an interface to a class with abstract members.")]
public class ConvertInterfaceToAbstractClassContextAction : ContextAction
{
public override async Task<bool> IsAvailableAsync(EditorRefactoringContext context, CancellationToken cancellationToken)
{
SyntaxTree st = await context.GetSyntaxTreeAsync().ConfigureAwait(false);
Identifier identifier = (Identifier) st.GetNodeAt(context.CaretLocation, node => node.Role == Roles.Identifier);
if (identifier == null)
return false;
TypeDeclaration typeDeclaration = identifier.Parent as TypeDeclaration;
return (typeDeclaration != null) && (typeDeclaration.ClassType == ClassType.Interface);
}
public override void Execute(EditorRefactoringContext context)
{
CSharpFullParseInformation parseInformation = context.GetParseInformation() as CSharpFullParseInformation;
if (parseInformation != null) {
SyntaxTree st = parseInformation.SyntaxTree;
Identifier identifier = (Identifier) st.GetNodeAt(context.CaretLocation, node => node.Role == Roles.Identifier);
if (identifier == null)
return;
TypeDeclaration interfaceTypeDeclaration = identifier.Parent as TypeDeclaration;
if (interfaceTypeDeclaration != null) {
// Generate abstract class from interface and abstract members from interface members
TypeDeclaration abstractClassTypeNode = (TypeDeclaration) interfaceTypeDeclaration.Clone();
abstractClassTypeNode.ClassType = ClassType.Class;
abstractClassTypeNode.Modifiers |= Modifiers.Abstract;
foreach (var entity in abstractClassTypeNode.Children.OfType<EntityDeclaration>()) {
entity.Modifiers |= Modifiers.Abstract | Modifiers.Public;
}
var refactoringContext = SDRefactoringContext.Create(context.Editor, CancellationToken.None);
using (Script script = refactoringContext.StartScript()) {
// Replace interface node with node of abstract class
script.Replace(interfaceTypeDeclaration, abstractClassTypeNode);
}
}
}
}
public override string DisplayName
{
get {
return "Convert interface to abstract class";
}
}
}
}

4
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/CreatePropertiesDialog.xaml.cs

@ -99,9 +99,9 @@ namespace CSharpBinding.Refactoring @@ -99,9 +99,9 @@ namespace CSharpBinding.Refactoring
AstType interfaceTypeNode = refactoringContext.CreateShortType("System.ComponentModel", "INotifyPropertyChanged", 0);
var directBaseTypes = currentClass.DirectBaseTypes.Where(t => t.FullName != "System.Object");
if (currentClassDeclaration.BaseTypes.Count > 0) {
script.InsertText(insertion, ", " + interfaceTypeNode.GetText() + " ");
script.InsertText(insertion, ", " + interfaceTypeNode + " ");
} else {
script.InsertText(insertion, " : " + interfaceTypeNode.GetText() + " ");
script.InsertText(insertion, " : " + interfaceTypeNode + " ");
}
}

2
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/OverrideEqualsGetHashCodeMethodsDialog.xaml.cs

@ -320,7 +320,7 @@ namespace CSharpBinding.Refactoring @@ -320,7 +320,7 @@ namespace CSharpBinding.Refactoring
method.Body.Add(new VariableDeclarationStatement(
currentType.Clone(),
"other",
new CastExpression(currentType.Clone(), new IdentifierExpression("obj"))));
new IdentifierExpression("obj").CastAs(currentType.Clone())));
method.Body.Add(new IfElseStatement(
new BinaryOperatorExpression(new IdentifierExpression("other"), BinaryOperatorType.Equality, new PrimitiveExpression(null, "null")),
new ReturnStatement(new PrimitiveExpression(false, "false"))));

15
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/PropertyOrFieldWrapper.cs

@ -45,6 +45,11 @@ namespace CSharpBinding.Refactoring @@ -45,6 +45,11 @@ namespace CSharpBinding.Refactoring
}
set {
isIncluded = value;
if (!value) {
// Remove other flags, too
AddCheckForNull = false;
AddRangeCheck = false;
}
OnPropertyChanged("IsIncluded");
}
}
@ -90,6 +95,11 @@ namespace CSharpBinding.Refactoring @@ -90,6 +95,11 @@ namespace CSharpBinding.Refactoring
get { return addCheckForNull; }
set {
addCheckForNull = value;
if (value) {
// Assure that IsIncluded is set to true as well
IsIncluded = true;
}
OnPropertyChanged("AddCheckForNull");
}
}
@ -98,6 +108,11 @@ namespace CSharpBinding.Refactoring @@ -98,6 +108,11 @@ namespace CSharpBinding.Refactoring
get { return addRangeCheck; }
set {
addRangeCheck = value;
if (value) {
// Assure that IsIncluded is set to true as well
IsIncluded = true;
}
OnPropertyChanged("AddRangeCheck");
}
}

11
src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.addin

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
<ConditionEvaluator name = "IsBreakpointActive" class="Debugger.AddIn.IsActiveBreakpointCondition" />
</Import>
<Import assembly="Debugger.Core.dll"/>
</Runtime>
</Runtime>
<Path name="/SharpDevelop/Services/DebuggerService/Debugger">
<Debugger id="DefaultDebugger"
@ -158,8 +158,15 @@ @@ -158,8 +158,15 @@
<Class class="Debugger.AddIn.Visualizers.ObjectGraphVisualizerDescriptor" />
<Class class="Debugger.AddIn.Visualizers.GridVisualizerDescriptor" />
</Path>
<Path name="/SharpDevelop/TreeNodeFactories">
<Class id="DebuggerTreeNodesFactory" class="ICSharpCode.SharpDevelop.Gui.Pads.DebuggerTreeNodesFactory" />
</Path>
<Path name = "/SharpDevelop/Services/DebuggerService/ModuleContextMenu">
<MenuItem id = "AddModuleToWorkspace"
label = "Add to workspace"
icon = "Icons.16x16.AssemblyFromFile"
class = "ICSharpCode.SharpDevelop.Gui.Pads.AddModuleToWorkspaceCommand"/>
</Path>
</AddIn>

38
src/AddIns/Debugger/Debugger.AddIn/Pads/ClassBrowserSupport.cs

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
using System;
using System.IO;
using Debugger;
using ICSharpCode.Core.Presentation;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.SharpDevelop.Dom;
@ -66,7 +67,8 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -66,7 +67,8 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
if (process == null)
throw new ArgumentNullException("process");
this.process = process;
this.modules = new SimpleModelCollection<Debugger.Module>(this.process.Modules);
this.modules = new NullSafeSimpleModelCollection<Debugger.Module>();
this.modules.AddRange(this.process.Modules);
this.process.ModuleLoaded += ModuleLoaded;
this.process.ModuleUnloaded += ModuleUnloaded;
}
@ -135,6 +137,14 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -135,6 +137,14 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
}
}
public override void ShowContextMenu()
{
var assemblyModel = this.Model as IAssemblyModel;
if (assemblyModel != null) {
var ctx = MenuService.ShowContextMenu(null, assemblyModel, "/SharpDevelop/Services/DebuggerService/ModuleContextMenu");
}
}
static IAssemblyModel CreateAssemblyModel(Module module)
{
// references??
@ -146,4 +156,30 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -146,4 +156,30 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
return model;
}
}
/// <summary>
/// RunAssemblyWithDebuggerCommand.
/// </summary>
class AddModuleToWorkspaceCommand : SimpleCommand
{
public override bool CanExecute(object parameter)
{
IAssemblyModel assemblyModel = parameter as IAssemblyModel;
return (assemblyModel != null) && assemblyModel.Context.IsValid;
}
public override void Execute(object parameter)
{
var classBrowser = SD.GetService<IClassBrowser>();
var modelFactory = SD.GetService<IModelFactory>();
if ((classBrowser != null) && (modelFactory != null)) {
IAssemblyModel assemblyModel = (IAssemblyModel) parameter;
// Create a new copy of this assembly model
IAssemblyModel newAssemblyModel = modelFactory.SafelyCreateAssemblyModelFromFile(assemblyModel.Context.Location);
if (newAssemblyModel != null)
classBrowser.AssemblyList.Assemblies.Add(newAssemblyModel);
}
}
}
}

12
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/DocumentPrinter.cs

@ -50,16 +50,14 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -50,16 +50,14 @@ namespace ICSharpCode.AvalonEdit.AddIn
// TableRow row = new TableRow();
// trg.Rows.Add(row);
// row.Cells.Add(new TableCell(new Paragraph(new Run(lineNumber.ToString()))) { TextAlignment = TextAlignment.Right });
HighlightedInlineBuilder inlineBuilder = new HighlightedInlineBuilder(document.GetText(line));
// Paragraph p = new Paragraph();
// row.Cells.Add(new TableCell(p));
if (highlighter != null) {
HighlightedLine highlightedLine = highlighter.HighlightLine(lineNumber);
int lineStartOffset = line.Offset;
foreach (HighlightedSection section in highlightedLine.Sections)
inlineBuilder.SetHighlighting(section.Offset - lineStartOffset, section.Length, section.Color);
p.Inlines.AddRange(highlightedLine.ToRichText().CreateRuns());
} else {
p.Inlines.Add(document.GetText(line));
}
// Paragraph p = new Paragraph();
// row.Cells.Add(new TableCell(p));
p.Inlines.AddRange(inlineBuilder.CreateRuns());
}
return p;
}

8
src/AddIns/Misc/AddInManager2/Project/Src/View/AddInsView.xaml

@ -119,6 +119,10 @@ @@ -119,6 +119,10 @@
</Style.Triggers>-->
</Style>
<Style x:Key="packageListBoxItemContainerStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="IsSelected" Value="{Binding Mode=TwoWay, Path=IsSelected}"/>
</Style>
<DataTemplate x:Key="PackageListBoxItemTemplate">
<Grid>
<Grid.ColumnDefinitions>
@ -491,7 +495,7 @@ @@ -491,7 +495,7 @@
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- <TextBlock
<!-- <TextBlock
Grid.Row="0"
Grid.Column="0"
VerticalAlignment="Center"
@ -550,8 +554,10 @@ @@ -550,8 +554,10 @@
x:Name="allPackagesListBox"
Grid.Row="0"
SelectedIndex="0"
IsSynchronizedWithCurrentItem="true"
ItemTemplate="{StaticResource PackageListBoxItemTemplate}"
ItemsSource="{Binding Path=AddInPackages}"
ItemContainerStyle="{StaticResource packageListBoxItemContainerStyle}"
HorizontalContentAlignment="Stretch"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"/>
<ProgressBar

6
src/AddIns/Misc/AddInManager2/Project/Src/ViewModel/AddInPackageViewModelBase.cs

@ -252,6 +252,12 @@ namespace ICSharpCode.AddInManager2.ViewModel @@ -252,6 +252,12 @@ namespace ICSharpCode.AddInManager2.ViewModel
return false;
}
}
public bool IsSelected
{
get;
set;
}
public virtual void AddPackage()
{

20
src/AddIns/Misc/AddInManager2/Project/Src/ViewModel/AddInsViewModelBase.cs

@ -23,6 +23,7 @@ namespace ICSharpCode.AddInManager2.ViewModel @@ -23,6 +23,7 @@ namespace ICSharpCode.AddInManager2.ViewModel
private bool _isReadingPackages;
private bool _isExpandedinView;
private bool _showPackageSources;
private string _lastSelectedId;
private ObservableCollection<PackageRepository> _packageRepositories;
@ -289,9 +290,11 @@ namespace ICSharpCode.AddInManager2.ViewModel @@ -289,9 +290,11 @@ namespace ICSharpCode.AddInManager2.ViewModel
protected void UpdatePackageViewModels(IEnumerable<AddInPackageViewModelBase> newPackageViewModels)
{
StoreSelection();
ClearPackages();
NuGet.CollectionExtensions.AddRange(AddInPackages, newPackageViewModels);
UpdateInstallationState();
RestoreSelection();
}
protected void ClearPackages()
@ -545,5 +548,22 @@ namespace ICSharpCode.AddInManager2.ViewModel @@ -545,5 +548,22 @@ namespace ICSharpCode.AddInManager2.ViewModel
// Update the list of package sources
UpdatePackageSources();
}
private void StoreSelection()
{
AddInPackageViewModelBase selectedModel = AddInPackages.FirstOrDefault(m => m.IsSelected);
if (selectedModel != null) {
_lastSelectedId = selectedModel.Id;
}
}
private void RestoreSelection()
{
AddInPackageViewModelBase modelToSelect = AddInPackages.FirstOrDefault(m => m.Id == _lastSelectedId);
if (modelToSelect != null) {
modelToSelect.IsSelected = true;
}
_lastSelectedId = null;
}
}
}

2
src/AddIns/Misc/AddInManager2/Project/Src/ViewModel/NuGetAddInsViewModelBase.cs

@ -49,7 +49,7 @@ namespace ICSharpCode.AddInManager2.ViewModel @@ -49,7 +49,7 @@ namespace ICSharpCode.AddInManager2.ViewModel
{
IsReadingPackages = true;
HasError = false;
ClearPackages();
// ClearPackages();
CancelReadPackagesTask();
CreateReadPackagesTask();
_task.Start();

2
src/AddIns/Misc/PackageManagement/Project/Src/Design/FakePackageManagementProjectService.cs

@ -40,7 +40,7 @@ namespace ICSharpCode.PackageManagement.Design @@ -40,7 +40,7 @@ namespace ICSharpCode.PackageManagement.Design
}
}
public readonly SimpleModelCollection<IModelCollection<IProject>> ProjectCollections = new SimpleModelCollection<IModelCollection<IProject>>();
public readonly IMutableModelCollection<IModelCollection<IProject>> ProjectCollections = new NullSafeSimpleModelCollection<IModelCollection<IProject>>();
IModelCollection<IProject> allProjects;
public IModelCollection<IProject> AllProjects {

2
src/AddIns/Misc/PackageManagement/Project/Src/PackageManagementWorkbench.cs

@ -49,7 +49,7 @@ namespace ICSharpCode.PackageManagement @@ -49,7 +49,7 @@ namespace ICSharpCode.PackageManagement
public R SafeThreadFunction<R>(Func<R> method)
{
return WorkbenchSingleton.SafeThreadFunction<R>(method);
return SD.MainThread.InvokeIfRequired(method);
}
}
}

4
src/AddIns/Misc/PackageManagement/Project/Src/ServiceWithWorkbenchOwner.cs

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
using System;
using System.Windows;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop;
namespace ICSharpCode.PackageManagement
{
@ -14,7 +14,7 @@ namespace ICSharpCode.PackageManagement @@ -14,7 +14,7 @@ namespace ICSharpCode.PackageManagement
public Window Owner {
get {
if (owner == null) {
owner = WorkbenchSingleton.MainWindow;
owner = SD.Workbench.MainWindow;
}
return owner;
}

2
src/AddIns/Misc/PackageManagement/Test/Src/Helpers/ProjectHelper.cs

@ -18,7 +18,7 @@ namespace PackageManagement.Tests.Helpers @@ -18,7 +18,7 @@ namespace PackageManagement.Tests.Helpers
SD.InitializeForUnitTests();
ISolution solution = MockRepository.GenerateStrictMock<ISolution>();
solution.Stub(s => s.MSBuildProjectCollection).Return(new Microsoft.Build.Evaluation.ProjectCollection());
solution.Stub(s => s.Projects).Return(new SimpleModelCollection<IProject>());
solution.Stub(s => s.Projects).Return(new NullSafeSimpleModelCollection<IProject>());
solution.Stub(s => s.ActiveConfiguration).Return(new ConfigurationAndPlatform("Debug", "Any CPU"));
//solution.Stub(s => s.FileName).Return(FileName.Create(@"d:\projects\Test\TestSolution.sln"));
return solution;

4
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/Commands/FormsCommand.cs

@ -67,7 +67,7 @@ namespace ICSharpCode.Reports.Addin.Commands @@ -67,7 +67,7 @@ namespace ICSharpCode.Reports.Addin.Commands
public override void Run()
{
IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
IWorkbenchWindow window = SD.Workbench.ActiveWorkbenchWindow;
if (window == null) {
return;
}
@ -89,7 +89,7 @@ namespace ICSharpCode.Reports.Addin.Commands @@ -89,7 +89,7 @@ namespace ICSharpCode.Reports.Addin.Commands
public override void Run()
{
PadDescriptor padContent = WorkbenchSingleton.Workbench.GetPad(typeof(ICSharpCode.SharpDevelop.Gui.PropertyPad));
PadDescriptor padContent = SD.Workbench.GetPad(typeof(ICSharpCode.SharpDevelop.Gui.PropertyPad));
if (padContent != null) {
padContent.BringPadToFront();
}

5
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/Commands/PreviewCommands.cs

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
using System;
using ICSharpCode.Core;
using ICSharpCode.Reports.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.Reports.Addin.Commands
@ -66,7 +67,7 @@ namespace ICSharpCode.Reports.Addin.Commands @@ -66,7 +67,7 @@ namespace ICSharpCode.Reports.Addin.Commands
public override void Run()
{
base.Run();
WorkbenchSingleton.StatusBar.SetMessage("Connect...");
SD.StatusBar.SetMessage("Connect...");
base.ReportViewer.RunReport(base.Model,(ReportParameters)null);
}
}
@ -84,7 +85,7 @@ namespace ICSharpCode.Reports.Addin.Commands @@ -84,7 +85,7 @@ namespace ICSharpCode.Reports.Addin.Commands
DataSetFromXsdCommand cmd = new DataSetFromXsdCommand();
cmd.Run();
System.Data.DataSet ds = cmd.DataSet;
WorkbenchSingleton.StatusBar.SetMessage("Connect...");
SD.StatusBar.SetMessage("Connect...");
base.ReportViewer.RunReport(base.Model,ds.Tables[0],null);
}

9
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportExplorer/ReportExplorerPad.cs

@ -8,6 +8,7 @@ using System.Windows.Forms; @@ -8,6 +8,7 @@ using System.Windows.Forms;
using ICSharpCode.Core.WinForms;
using ICSharpCode.Reports.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Workbench;
@ -29,8 +30,8 @@ namespace ICSharpCode.Reports.Addin @@ -29,8 +30,8 @@ namespace ICSharpCode.Reports.Addin
public ReportExplorerPad():base()
{
WorkbenchSingleton.Workbench.ActiveViewContentChanged += ActiveViewContentChanged;
WorkbenchSingleton.Workbench.ViewClosed += ActiveViewClosed;
SD.Workbench.ActiveViewContentChanged += ActiveViewContentChanged;
SD.Workbench.ViewClosed += ActiveViewClosed;
this.explorerTree = new ExplorerTree();
this.explorerTree.MouseDown += new MouseEventHandler(ReportExplorer_MouseDown);
this.explorerTree.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(ReportExplorerPad_PropertyChanged);
@ -63,7 +64,7 @@ namespace ICSharpCode.Reports.Addin @@ -63,7 +64,7 @@ namespace ICSharpCode.Reports.Addin
void ActiveViewContentChanged(object source, EventArgs e)
{
ReportDesignerView vv = WorkbenchSingleton.Workbench.ActiveViewContent as ReportDesignerView;
ReportDesignerView vv = SD.Workbench.ActiveViewContent as ReportDesignerView;
if (vv != null) {
Console.WriteLine("Explorerpad:ActiveViewContentChanged {0}",vv.TitleName);
}
@ -184,7 +185,7 @@ namespace ICSharpCode.Reports.Addin @@ -184,7 +185,7 @@ namespace ICSharpCode.Reports.Addin
/// </summary>
public override void Dispose()
{
WorkbenchSingleton.Workbench.ActiveViewContentChanged -= ActiveViewContentChanged;
SD.Workbench.ActiveViewContentChanged -= ActiveViewContentChanged;
this.explorerTree.Dispose();
}

15
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/BaseSettingsPanel.cs

@ -224,15 +224,12 @@ namespace ICSharpCode.Reports.Addin.ReportWizard{ @@ -224,15 +224,12 @@ namespace ICSharpCode.Reports.Addin.ReportWizard{
private void OnSelectFolder(object sender, System.EventArgs e)
{
using (FolderBrowserDialog fd = FileService.CreateFolderBrowserDialog("")) {
if (fd.ShowDialog() == DialogResult.OK) {
if (!String.IsNullOrEmpty(fd.SelectedPath)) {
if (!fd.SelectedPath.EndsWith(@"\",StringComparison.OrdinalIgnoreCase)){
this.txtPath.Text = fd.SelectedPath + @"\";
} else {
this.txtPath.Text = fd.SelectedPath;
}
}
string selectedPath = SD.FileService.BrowseForFolder("");
if (!String.IsNullOrEmpty(selectedPath)) {
if (!selectedPath.EndsWith(@"\",StringComparison.OrdinalIgnoreCase)){
this.txtPath.Text = selectedPath + @"\";
} else {
this.txtPath.Text = selectedPath;
}
}
}

24
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/ReportWizard/WizardPanels/Wizard/AbstractOptionPanel.cs

@ -196,20 +196,16 @@ namespace ICSharpCode.Reports.Addin.ReportWizard @@ -196,20 +196,16 @@ namespace ICSharpCode.Reports.Addin.ReportWizard
startLocation = FileUtility.GetAbsolutePath(startLocation, text);
}
using (FolderBrowserDialog fdiag = FileService.CreateFolderBrowserDialog(description, startLocation)) {
if (fdiag.ShowDialog() == DialogResult.OK) {
string path = fdiag.SelectedPath;
if (panel.baseDirectory != null) {
path = FileUtility.GetRelativePath(panel.baseDirectory, path);
}
if (!path.EndsWith("\\") && !path.EndsWith("/"))
path += "\\";
if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) {
panel.ControlDictionary[target].Text = path;
} else {
panel.ControlDictionary[target].Text = MSBuildInternals.Escape(path);
}
}
string path = SD.FileService.BrowseForFolder(description, startLocation);
if (panel.baseDirectory != null) {
path = FileUtility.GetRelativePath(panel.baseDirectory, path);
}
if (!path.EndsWith("\\", StringComparison.Ordinal) && !path.EndsWith("/", StringComparison.Ordinal))
path += "\\";
if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) {
panel.ControlDictionary[target].Text = path;
} else {
panel.ControlDictionary[target].Text = MSBuildInternals.Escape(path);
}
}
}

5
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/Services/UIService.cs

@ -8,11 +8,12 @@ using System.Windows.Forms; @@ -8,11 +8,12 @@ using System.Windows.Forms;
using System.Windows.Forms.Design;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.Reports.Addin
{
public class UIService : IUIService
public class UIService : System.Windows.Forms.Design.IUIService
{
IDictionary styles = new Hashtable();
@ -48,7 +49,7 @@ namespace ICSharpCode.Reports.Addin @@ -48,7 +49,7 @@ namespace ICSharpCode.Reports.Addin
#region Dialog functions
public IWin32Window GetDialogOwnerWindow()
{
return WorkbenchSingleton.MainWin32Window;
return SD.WinForms.MainWin32Window;
}
public DialogResult ShowDialog(Form form)

2
src/AddIns/Misc/Reports/ICSharpCode.Reports.Addin/Project/Toolbox/ToolboxProvider.cs

@ -149,7 +149,7 @@ namespace ICSharpCode.Reports.Addin @@ -149,7 +149,7 @@ namespace ICSharpCode.Reports.Addin
public static SharpDevelopSideBar ReportingSideBar {
get {
Debug.Assert(WorkbenchSingleton.InvokeRequired == false);
SD.MainThread.VerifyAccess();
if (reportingSideBar == null) {
reportingSideBar = new SharpDevelopSideBar();
reportingSideBar.Tabs.Add(standardSideTab);

14
src/AddIns/Misc/SearchAndReplace/Project/Gui/SearchResultNode.cs

@ -66,17 +66,15 @@ namespace SearchAndReplace @@ -66,17 +66,15 @@ namespace SearchAndReplace
textBlock.Inlines.Add("(" + location.Line + ", " + location.Column + ")\t");
string displayText = result.DisplayText;
RichText displayText = result.DisplayText;
if (displayText != null) {
textBlock.Inlines.Add(displayText);
} else if (result.Builder != null) {
HighlightedInlineBuilder builder = result.Builder;
if (IsSelected) {
builder = builder.Clone();
builder.SetForeground(0, builder.Text.Length, null);
builder.SetBackground(0, builder.Text.Length, null);
RichTextModel model = displayText.ToRichTextModel();
model.SetForeground(0, displayText.Length, null);
model.SetBackground(0, displayText.Length, null);
displayText = new RichText(displayText.Text, model);
}
textBlock.Inlines.AddRange(builder.CreateRuns());
textBlock.Inlines.AddRange(displayText.CreateRuns());
}
if (showFileName) {

6
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Highlighting/HtmlClipboardTests.cs

@ -25,9 +25,9 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -25,9 +25,9 @@ namespace ICSharpCode.AvalonEdit.Highlighting
{
var segment = new TextSegment { StartOffset = 0, Length = document.TextLength };
string html = HtmlClipboard.CreateHtmlFragment(document, highlighter, segment, new HtmlOptions());
Assert.AreEqual("<span style=\"color: #008000; font-weight: bold; \">using</span>&nbsp;System.Text;<br>" + Environment.NewLine +
"&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #ff0000; \">string</span>&nbsp;" +
"text =&nbsp;<span style=\"color: #191970; font-weight: bold; \">SomeMethod</span>();", html);
Assert.AreEqual("<span style=\"color: #008000; font-weight: bold; \">using</span> System.Text;<br>" + Environment.NewLine +
"&nbsp;&nbsp;&nbsp;&nbsp;<span style=\"color: #ff0000; \">string</span> " +
"text = <span style=\"color: #191970; font-weight: bold; \">SomeMethod</span>();", html);
}
[Test]

36
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit.Tests/Utils/CompressingTreeListTests.cs

@ -30,12 +30,7 @@ namespace ICSharpCode.AvalonEdit.Utils @@ -30,12 +30,7 @@ namespace ICSharpCode.AvalonEdit.Utils
list.InsertRange(0, billion, "A");
list.InsertRange(1, billion, "B");
Assert.AreEqual(2 * billion, list.Count);
try {
list.InsertRange(2, billion, "C");
Assert.Fail("Expected OverflowException");
} catch (OverflowException) {
// expected
}
Assert.Throws<OverflowException>(delegate { list.InsertRange(2, billion, "C"); });
}
[Test]
@ -103,5 +98,34 @@ namespace ICSharpCode.AvalonEdit.Utils @@ -103,5 +98,34 @@ namespace ICSharpCode.AvalonEdit.Utils
list.RemoveRange(0, 3);
Assert.AreEqual(new[] { 2, 3, 3 }, list.ToArray());
}
[Test]
public void Transform()
{
CompressingTreeList<int> list = new CompressingTreeList<int>((a, b) => a == b);
list.AddRange(new[] { 0, 1, 1, 0 });
int calls = 0;
list.Transform(i => { calls++; return i + 1; });
Assert.AreEqual(3, calls);
Assert.AreEqual(new[] { 1, 2, 2, 1 }, list.ToArray());
}
[Test]
public void TransformToZero()
{
CompressingTreeList<int> list = new CompressingTreeList<int>((a, b) => a == b);
list.AddRange(new[] { 0, 1, 1, 0 });
list.Transform(i => 0);
Assert.AreEqual(new[] { 0, 0, 0, 0 }, list.ToArray());
}
[Test]
public void TransformRange()
{
CompressingTreeList<int> list = new CompressingTreeList<int>((a, b) => a == b);
list.AddRange(new[] { 0, 1, 1, 1, 0, 0 });
list.TransformRange(2, 3, i => 0);
Assert.AreEqual(new[] { 0, 1, 0, 0, 0, 0 }, list.ToArray());
}
}
}

69
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/DocumentTextWriter.cs

@ -0,0 +1,69 @@ @@ -0,0 +1,69 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.IO;
using System.Text;
using ICSharpCode.NRefactory.Editor;
namespace ICSharpCode.AvalonEdit.Document
{
/// <summary>
/// A TextWriter implementation that directly inserts into a document.
/// </summary>
public class DocumentTextWriter : TextWriter
{
readonly IDocument document;
int insertionOffset;
/// <summary>
/// Creates a new DocumentTextWriter that inserts into document, starting at insertionOffset.
/// </summary>
public DocumentTextWriter(IDocument document, int insertionOffset)
{
this.insertionOffset = insertionOffset;
if (document == null)
throw new ArgumentNullException("document");
this.document = document;
var line = document.GetLineByOffset(insertionOffset);
if (line.DelimiterLength == 0)
line = line.PreviousLine;
if (line != null)
this.NewLine = document.GetText(line.EndOffset, line.DelimiterLength);
}
/// <summary>
/// Gets/Sets the current insertion offset.
/// </summary>
public int InsertionOffset {
get { return insertionOffset; }
set { insertionOffset = value; }
}
/// <inheritdoc/>
public override void Write(char value)
{
document.Insert(insertionOffset, value.ToString());
insertionOffset++;
}
/// <inheritdoc/>
public override void Write(char[] buffer, int index, int count)
{
document.Insert(insertionOffset, new string(buffer, index, count));
insertionOffset += count;
}
/// <inheritdoc/>
public override void Write(string value)
{
document.Insert(insertionOffset, value);
insertionOffset += value.Length;
}
/// <inheritdoc/>
public override Encoding Encoding {
get { return Encoding.UTF8; }
}
}
}

4
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/NewLineFinder.cs

@ -117,9 +117,9 @@ namespace ICSharpCode.AvalonEdit.Document @@ -117,9 +117,9 @@ namespace ICSharpCode.AvalonEdit.Document
/// <summary>
/// Gets the newline sequence used in the document at the specified line.
/// </summary>
public static string GetNewLineFromDocument(TextDocument document, int lineNumber)
public static string GetNewLineFromDocument(IDocument document, int lineNumber)
{
DocumentLine line = document.GetLineByNumber(lineNumber);
IDocumentLine line = document.GetLineByNumber(lineNumber);
if (line.DelimiterLength == 0) {
// at the end of the document, there's no line delimiter, so use the delimiter
// from the previous line

4
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/OffsetChangeMap.cs

@ -108,7 +108,7 @@ namespace ICSharpCode.AvalonEdit.Document @@ -108,7 +108,7 @@ namespace ICSharpCode.AvalonEdit.Document
/// <summary>
/// Gets the new offset where the specified offset moves after this document change.
/// </summary>
public int GetNewOffset(int offset, AnchorMovementType movementType)
public int GetNewOffset(int offset, AnchorMovementType movementType = AnchorMovementType.Default)
{
IList<OffsetChangeMapEntry> items = this.Items;
int count = items.Count;
@ -255,7 +255,7 @@ namespace ICSharpCode.AvalonEdit.Document @@ -255,7 +255,7 @@ namespace ICSharpCode.AvalonEdit.Document
/// <summary>
/// Gets the new offset where the specified offset moves after this document change.
/// </summary>
public int GetNewOffset(int oldOffset, AnchorMovementType movementType)
public int GetNewOffset(int oldOffset, AnchorMovementType movementType = AnchorMovementType.Default)
{
int insertionLength = this.InsertionLength;
int removalLength = this.RemovalLength;

1
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Document/TextDocumentWeakEventManager.cs

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.AvalonEdit.Utils;
namespace ICSharpCode.AvalonEdit.Document

106
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedInlineBuilder.cs

@ -5,9 +5,11 @@ using System; @@ -5,9 +5,11 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Media;
using ICSharpCode.NRefactory.TypeSystem.Implementation;
namespace ICSharpCode.AvalonEdit.Highlighting
{
@ -20,31 +22,21 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -20,31 +22,21 @@ namespace ICSharpCode.AvalonEdit.Highlighting
/// into a TextBlock.
/// In SharpDevelop, we use it to provide syntax highlighting inside the search results pad.
/// </remarks>
[Obsolete("Use RichText / RichTextModel instead")]
public sealed class HighlightedInlineBuilder
{
sealed class HighlightingState
static HighlightingBrush MakeBrush(Brush b)
{
internal Brush Foreground;
internal Brush Background;
internal FontFamily Family;
internal FontWeight? Weight;
internal FontStyle? Style;
public HighlightingState Clone()
{
return new HighlightingState {
Foreground = this.Foreground,
Background = this.Background,
Family = this.Family,
Weight = this.Weight,
Style = this.Style
};
}
SolidColorBrush scb = b as SolidColorBrush;
if (scb != null)
return new SimpleHighlightingBrush(scb);
else
return null;
}
readonly string text;
List<int> stateChangeOffsets = new List<int>();
List<HighlightingState> stateChanges = new List<HighlightingState>();
List<HighlightingColor> stateChanges = new List<HighlightingColor>();
int GetIndexForOffset(int offset)
{
@ -70,14 +62,26 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -70,14 +62,26 @@ namespace ICSharpCode.AvalonEdit.Highlighting
throw new ArgumentNullException("text");
this.text = text;
stateChangeOffsets.Add(0);
stateChanges.Add(new HighlightingState());
stateChanges.Add(new HighlightingColor());
}
/// <summary>
/// Creates a new HighlightedInlineBuilder instance.
/// </summary>
public HighlightedInlineBuilder(RichText text)
{
if (text == null)
throw new ArgumentNullException("text");
this.text = text.Text;
stateChangeOffsets.AddRange(text.stateChangeOffsets);
stateChanges.AddRange(text.stateChanges);
}
HighlightedInlineBuilder(string text, int[] offsets, HighlightingState[] states)
HighlightedInlineBuilder(string text, List<int> offsets, List<HighlightingColor> states)
{
this.text = text;
stateChangeOffsets.AddRange(offsets);
stateChanges.AddRange(states);
stateChangeOffsets = offsets;
stateChanges = states;
}
/// <summary>
@ -103,15 +107,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -103,15 +107,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting
int startIndex = GetIndexForOffset(offset);
int endIndex = GetIndexForOffset(offset + length);
for (int i = startIndex; i < endIndex; i++) {
HighlightingState state = stateChanges[i];
if (color.Foreground != null)
state.Foreground = color.Foreground.GetBrush(null);
if (color.Background != null)
state.Background = color.Background.GetBrush(null);
if (color.FontStyle != null)
state.Style = color.FontStyle;
if (color.FontWeight != null)
state.Weight = color.FontWeight;
stateChanges[i].MergeWith(color);
}
}
@ -122,8 +118,9 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -122,8 +118,9 @@ namespace ICSharpCode.AvalonEdit.Highlighting
{
int startIndex = GetIndexForOffset(offset);
int endIndex = GetIndexForOffset(offset + length);
var hbrush = MakeBrush(brush);
for (int i = startIndex; i < endIndex; i++) {
stateChanges[i].Foreground = brush;
stateChanges[i].Foreground = hbrush;
}
}
@ -134,8 +131,9 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -134,8 +131,9 @@ namespace ICSharpCode.AvalonEdit.Highlighting
{
int startIndex = GetIndexForOffset(offset);
int endIndex = GetIndexForOffset(offset + length);
var hbrush = MakeBrush(brush);
for (int i = startIndex; i < endIndex; i++) {
stateChanges[i].Background = brush;
stateChanges[i].Background = hbrush;
}
}
@ -147,7 +145,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -147,7 +145,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting
int startIndex = GetIndexForOffset(offset);
int endIndex = GetIndexForOffset(offset + length);
for (int i = startIndex; i < endIndex; i++) {
stateChanges[i].Weight = weight;
stateChanges[i].FontWeight = weight;
}
}
@ -159,46 +157,24 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -159,46 +157,24 @@ namespace ICSharpCode.AvalonEdit.Highlighting
int startIndex = GetIndexForOffset(offset);
int endIndex = GetIndexForOffset(offset + length);
for (int i = startIndex; i < endIndex; i++) {
stateChanges[i].Style = style;
stateChanges[i].FontStyle = style;
}
}
/// <summary>
/// Sets the font family on the specified text segment.
/// Creates WPF Run instances that can be used for TextBlock.Inlines.
/// </summary>
public void SetFontFamily(int offset, int length, FontFamily family)
public Run[] CreateRuns()
{
int startIndex = GetIndexForOffset(offset);
int endIndex = GetIndexForOffset(offset + length);
for (int i = startIndex; i < endIndex; i++) {
stateChanges[i].Family = family;
}
return ToRichText().CreateRuns();
}
/// <summary>
/// Creates WPF Run instances that can be used for TextBlock.Inlines.
/// Creates a RichText instance.
/// </summary>
public Run[] CreateRuns()
public RichText ToRichText()
{
Run[] runs = new Run[stateChanges.Count];
for (int i = 0; i < runs.Length; i++) {
int startOffset = stateChangeOffsets[i];
int endOffset = i + 1 < stateChangeOffsets.Count ? stateChangeOffsets[i + 1] : text.Length;
Run r = new Run(text.Substring(startOffset, endOffset - startOffset));
HighlightingState state = stateChanges[i];
if (state.Foreground != null)
r.Foreground = state.Foreground;
if (state.Background != null)
r.Background = state.Background;
if (state.Weight != null)
r.FontWeight = state.Weight.Value;
if (state.Family != null)
r.FontFamily = state.Family;
if (state.Style != null)
r.FontStyle = state.Style.Value;
runs[i] = r;
}
return runs;
return new RichText(text, stateChangeOffsets.ToArray(), stateChanges.Select(FreezableHelper.GetFrozenClone).ToArray());
}
/// <summary>
@ -207,8 +183,8 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -207,8 +183,8 @@ namespace ICSharpCode.AvalonEdit.Highlighting
public HighlightedInlineBuilder Clone()
{
return new HighlightedInlineBuilder(this.text,
stateChangeOffsets.ToArray(),
stateChanges.Select(sc => sc.Clone()).ToArray());
stateChangeOffsets.ToList(),
stateChanges.Select(sc => sc.Clone()).ToList());
}
}
}

84
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightedLine.cs

@ -167,7 +167,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -167,7 +167,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting
}
#endregion
#region ToHtml
#region WriteTo / ToHtml
sealed class HtmlElement : IComparable<HtmlElement>
{
internal readonly int Offset;
@ -203,21 +203,21 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -203,21 +203,21 @@ namespace ICSharpCode.AvalonEdit.Highlighting
}
/// <summary>
/// Produces HTML code for the line, with &lt;span class="colorName"&gt; tags.
/// Writes the highlighted line to the RichTextWriter.
/// </summary>
public string ToHtml(HtmlOptions options)
internal void WriteTo(RichTextWriter writer)
{
int startOffset = this.DocumentLine.Offset;
return ToHtml(startOffset, startOffset + this.DocumentLine.Length, options);
WriteTo(writer, startOffset, startOffset + this.DocumentLine.Length);
}
/// <summary>
/// Produces HTML code for a section of the line, with &lt;span class="colorName"&gt; tags.
/// Writes a part of the highlighted line to the RichTextWriter.
/// </summary>
public string ToHtml(int startOffset, int endOffset, HtmlOptions options)
internal void WriteTo(RichTextWriter writer, int startOffset, int endOffset)
{
if (options == null)
throw new ArgumentNullException("options");
if (writer == null)
throw new ArgumentNullException("writer");
int documentLineStartOffset = this.DocumentLine.Offset;
int documentLineEndOffset = documentLineStartOffset + this.DocumentLine.Length;
if (startOffset < documentLineStartOffset || startOffset > documentLineEndOffset)
@ -237,47 +237,85 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -237,47 +237,85 @@ namespace ICSharpCode.AvalonEdit.Highlighting
elements.Sort();
IDocument document = this.Document;
StringWriter w = new StringWriter(CultureInfo.InvariantCulture);
int textOffset = startOffset;
foreach (HtmlElement e in elements) {
int newOffset = Math.Min(e.Offset, endOffset);
if (newOffset > startOffset) {
HtmlClipboard.EscapeHtml(w, document.GetText(textOffset, newOffset - textOffset), options);
document.WriteTextTo(writer, textOffset, newOffset - textOffset);
}
textOffset = Math.Max(textOffset, newOffset);
if (options.ColorNeedsSpanForStyling(e.Color)) {
if (e.IsEnd) {
w.Write("</span>");
} else {
w.Write("<span");
options.WriteStyleAttributeForColor(w, e.Color);
w.Write('>');
}
}
if (e.IsEnd)
writer.EndSpan();
else
writer.BeginSpan(e.Color);
}
HtmlClipboard.EscapeHtml(w, document.GetText(textOffset, endOffset - textOffset), options);
return w.ToString();
document.WriteTextTo(writer, textOffset, endOffset - textOffset);
}
/// <summary>
/// Produces HTML code for the line, with &lt;span class="colorName"&gt; tags.
/// </summary>
public string ToHtml(HtmlOptions options = null)
{
StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture);
using (var htmlWriter = new HtmlRichTextWriter(stringWriter, options)) {
WriteTo(htmlWriter);
}
return stringWriter.ToString();
}
/// <summary>
/// Produces HTML code for a section of the line, with &lt;span class="colorName"&gt; tags.
/// </summary>
public string ToHtml(int startOffset, int endOffset, HtmlOptions options = null)
{
StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture);
using (var htmlWriter = new HtmlRichTextWriter(stringWriter, options)) {
WriteTo(htmlWriter, startOffset, endOffset);
}
return stringWriter.ToString();
}
/// <inheritdoc/>
public override string ToString()
{
return "[" + GetType().Name + " " + ToHtml(new HtmlOptions()) + "]";
return "[" + GetType().Name + " " + ToHtml() + "]";
}
#endregion
/// <summary>
/// Creates a <see cref="HighlightedInlineBuilder"/> that stores the text and highlighting of this line.
/// </summary>
[Obsolete("Use ToRichText() instead")]
public HighlightedInlineBuilder ToInlineBuilder()
{
HighlightedInlineBuilder builder = new HighlightedInlineBuilder(Document.GetText(DocumentLine));
int startOffset = DocumentLine.Offset;
// copy only the foreground and background colors
foreach (HighlightedSection section in Sections) {
builder.SetHighlighting(section.Offset - startOffset, section.Length, section.Color);
}
return builder;
}
/// <summary>
/// Creates a <see cref="RichTextModel"/> that stores the highlighting of this line.
/// </summary>
public RichTextModel ToRichTextModel()
{
var builder = new RichTextModel();
int startOffset = DocumentLine.Offset;
foreach (HighlightedSection section in Sections) {
builder.ApplyHighlighting(section.Offset - startOffset, section.Length, section.Color);
}
return builder;
}
/// <summary>
/// Creates a <see cref="RichText"/> that stores the text and highlighting of this line.
/// </summary>
public RichText ToRichText()
{
return new RichText(Document.GetText(DocumentLine), ToRichTextModel());
}
}
}

26
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingBrush.cs

@ -75,6 +75,19 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -75,6 +75,19 @@ namespace ICSharpCode.AvalonEdit.Highlighting
{
info.AddValue("color", brush.Color.ToString(CultureInfo.InvariantCulture));
}
public override bool Equals(object obj)
{
SimpleHighlightingBrush other = obj as SimpleHighlightingBrush;
if (other == null)
return false;
return this.brush.Color.Equals(other.brush.Color);
}
public override int GetHashCode()
{
return brush.Color.GetHashCode();
}
}
/// <summary>
@ -113,5 +126,18 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -113,5 +126,18 @@ namespace ICSharpCode.AvalonEdit.Highlighting
{
info.AddValue("propertyName", property.Name);
}
public override bool Equals(object obj)
{
SystemColorHighlightingBrush other = obj as SystemColorHighlightingBrush;
if (other == null)
return false;
return object.Equals(this.property, other.property);
}
public override int GetHashCode()
{
return property.GetHashCode();
}
}
}

78
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColor.cs

@ -8,6 +8,8 @@ using System.Security.Permissions; @@ -8,6 +8,8 @@ using System.Security.Permissions;
using System.Text;
using System.Windows;
using System.Windows.Media;
using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.NRefactory.TypeSystem.Implementation;
namespace ICSharpCode.AvalonEdit.Highlighting
{
@ -15,8 +17,10 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -15,8 +17,10 @@ namespace ICSharpCode.AvalonEdit.Highlighting
/// A highlighting color is a set of font properties and foreground and background color.
/// </summary>
[Serializable]
public class HighlightingColor : ISerializable
public class HighlightingColor : ISerializable, IFreezable, ICloneable, IEquatable<HighlightingColor>
{
internal static readonly HighlightingColor Empty = FreezableHelper.FreezeAndReturn(new HighlightingColor());
string name;
FontWeight? fontWeight;
FontStyle? fontStyle;
@ -175,7 +179,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -175,7 +179,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting
/// <summary>
/// Prevent further changes to this highlighting color.
/// </summary>
public void Freeze()
public virtual void Freeze()
{
frozen = true;
}
@ -186,5 +190,75 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -186,5 +190,75 @@ namespace ICSharpCode.AvalonEdit.Highlighting
public bool IsFrozen {
get { return frozen; }
}
/// <summary>
/// Clones this highlighting color.
/// If this color is frozen, the clone will be unfrozen.
/// </summary>
public virtual HighlightingColor Clone()
{
HighlightingColor c = (HighlightingColor)MemberwiseClone();
c.frozen = false;
return c;
}
object ICloneable.Clone()
{
return Clone();
}
/// <inheritdoc/>
public override sealed bool Equals(object obj)
{
return Equals(obj as HighlightingColor);
}
/// <inheritdoc/>
public virtual bool Equals(HighlightingColor other)
{
if (other == null)
return false;
return this.name == other.name && this.fontWeight == other.fontWeight && this.fontStyle == other.fontStyle && object.Equals(this.foreground, other.foreground) && object.Equals(this.background, other.background);
}
/// <inheritdoc/>
public override int GetHashCode()
{
int hashCode = 0;
unchecked {
if (name != null)
hashCode += 1000000007 * name.GetHashCode();
hashCode += 1000000009 * fontWeight.GetHashCode();
hashCode += 1000000021 * fontStyle.GetHashCode();
if (foreground != null)
hashCode += 1000000033 * foreground.GetHashCode();
if (background != null)
hashCode += 1000000087 * background.GetHashCode();
}
return hashCode;
}
/// <summary>
/// Overwrites the properties in this HighlightingColor with those from the given color;
/// but maintains the current values where the properties of the given color return <c>null</c>.
/// </summary>
public void MergeWith(HighlightingColor color)
{
FreezableHelper.ThrowIfFrozen(this);
if (color.fontWeight != null)
this.fontWeight = color.fontWeight;
if (color.fontStyle != null)
this.fontStyle = color.fontStyle;
if (color.foreground != null)
this.foreground = color.foreground;
if (color.background != null)
this.background = color.background;
}
internal bool IsEmptyForMerge {
get {
return fontWeight == null && fontStyle == null && foreground == null && background == null;
}
}
}
}

11
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HighlightingColorizer.cs

@ -211,7 +211,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -211,7 +211,7 @@ namespace ICSharpCode.AvalonEdit.Highlighting
/// Gets whether the color is empty (has no effect on a VisualLineTextElement).
/// For example, the C# "Punctuation" is an empty color.
/// </summary>
bool IsEmptyColor(HighlightingColor color)
internal static bool IsEmptyColor(HighlightingColor color)
{
if (color == null)
return true;
@ -223,14 +223,19 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -223,14 +223,19 @@ namespace ICSharpCode.AvalonEdit.Highlighting
/// Applies a highlighting color to a visual line element.
/// </summary>
protected virtual void ApplyColorToElement(VisualLineElement element, HighlightingColor color)
{
ApplyColorToElement(element, color, CurrentContext);
}
internal static void ApplyColorToElement(VisualLineElement element, HighlightingColor color, ITextRunConstructionContext context)
{
if (color.Foreground != null) {
Brush b = color.Foreground.GetBrush(CurrentContext);
Brush b = color.Foreground.GetBrush(context);
if (b != null)
element.TextRunProperties.SetForegroundBrush(b);
}
if (color.Background != null) {
Brush b = color.Background.GetBrush(CurrentContext);
Brush b = color.Background.GetBrush(context);
if (b != null)
element.BackgroundBrush = b;
}

103
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlClipboard.cs

@ -94,108 +94,5 @@ namespace ICSharpCode.AvalonEdit.Highlighting @@ -94,108 +94,5 @@ namespace ICSharpCode.AvalonEdit.Highlighting
}
return html.ToString();
}
/// <summary>
/// Escapes text and writes the result to the StringBuilder.
/// </summary>
internal static void EscapeHtml(StringWriter w, string text, HtmlOptions options)
{
int spaceCount = -1;
foreach (char c in text) {
if (c == ' ') {
if (spaceCount < 0)
w.Write("&nbsp;");
else
spaceCount++;
} else if (c == '\t') {
if (spaceCount < 0)
spaceCount = 0;
spaceCount += options.TabSize;
} else {
if (spaceCount == 1) {
w.Write(' ');
} else if (spaceCount >= 1) {
for (int i = 0; i < spaceCount; i++) {
w.Write("&nbsp;");
}
}
spaceCount = 0;
switch (c) {
case '<':
w.Write("&lt;");
break;
case '>':
w.Write("&gt;");
break;
case '&':
w.Write("&amp;");
break;
case '"':
w.Write("&quot;");
break;
default:
w.Write(c);
break;
}
}
}
for (int i = 0; i < spaceCount; i++) {
w.Write("&nbsp;");
}
}
}
/// <summary>
/// Holds options for converting text to HTML.
/// </summary>
public class HtmlOptions
{
/// <summary>
/// Creates a default HtmlOptions instance.
/// </summary>
public HtmlOptions()
{
this.TabSize = 4;
}
/// <summary>
/// Creates a new HtmlOptions instance that copies applicable options from the <see cref="TextEditorOptions"/>.
/// </summary>
public HtmlOptions(TextEditorOptions options)
: this()
{
if (options == null)
throw new ArgumentNullException("options");
this.TabSize = options.IndentationSize;
}
/// <summary>
/// The amount of spaces a tab gets converted to.
/// </summary>
public int TabSize { get; set; }
/// <summary>
/// Writes the HTML attribute for the style to the text writer.
/// </summary>
public virtual void WriteStyleAttributeForColor(TextWriter writer, HighlightingColor color)
{
if (writer == null)
throw new ArgumentNullException("writer");
if (color == null)
throw new ArgumentNullException("color");
writer.Write(" style=\"");
writer.Write(color.ToCss());
writer.Write("\"");
}
/// <summary>
/// Gets whether the color needs to be written out to HTML.
/// </summary>
public virtual bool ColorNeedsSpanForStyling(HighlightingColor color)
{
if (color == null)
throw new ArgumentNullException("color");
return !string.IsNullOrEmpty(color.ToCss());
}
}
}

62
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlOptions.cs

@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.IO;
using System.Net;
namespace ICSharpCode.AvalonEdit.Highlighting
{
/// <summary>
/// Holds options for converting text to HTML.
/// </summary>
public class HtmlOptions
{
/// <summary>
/// Creates a default HtmlOptions instance.
/// </summary>
public HtmlOptions()
{
this.TabSize = 4;
}
/// <summary>
/// Creates a new HtmlOptions instance that copies applicable options from the <see cref="TextEditorOptions"/>.
/// </summary>
public HtmlOptions(TextEditorOptions options) : this()
{
if (options == null)
throw new ArgumentNullException("options");
this.TabSize = options.IndentationSize;
}
/// <summary>
/// The amount of spaces a tab gets converted to.
/// </summary>
public int TabSize { get; set; }
/// <summary>
/// Writes the HTML attribute for the style to the text writer.
/// </summary>
public virtual void WriteStyleAttributeForColor(TextWriter writer, HighlightingColor color)
{
if (writer == null)
throw new ArgumentNullException("writer");
if (color == null)
throw new ArgumentNullException("color");
writer.Write(" style=\"");
WebUtility.HtmlEncode(color.ToCss(), writer);
writer.Write('"');
}
/// <summary>
/// Gets whether the color needs to be written out to HTML.
/// </summary>
public virtual bool ColorNeedsSpanForStyling(HighlightingColor color)
{
if (color == null)
throw new ArgumentNullException("color");
return !string.IsNullOrEmpty(color.ToCss());
}
}
}

236
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/HtmlRichTextWriter.cs

@ -0,0 +1,236 @@ @@ -0,0 +1,236 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using System.Windows;
using System.Windows.Media;
using ICSharpCode.AvalonEdit.Utils;
namespace ICSharpCode.AvalonEdit.Highlighting
{
/// <summary>
/// RichTextWriter implementation that produces HTML.
/// </summary>
class HtmlRichTextWriter : RichTextWriter
{
readonly TextWriter htmlWriter;
readonly HtmlOptions options;
Stack<string> endTagStack = new Stack<string>();
bool spaceNeedsEscaping = true;
bool hasSpace;
bool needIndentation = true;
int indentationLevel;
/// <summary>
/// Creates a new HtmlRichTextWriter instance.
/// </summary>
/// <param name="htmlWriter">
/// The text writer where the raw HTML is written to.
/// The HtmlRichTextWriter does not take ownership of the htmlWriter;
/// disposing the HtmlRichTextWriter will not dispose the underlying htmlWriter!
/// </param>
/// <param name="options">Options that control the HTML output.</param>
public HtmlRichTextWriter(TextWriter htmlWriter, HtmlOptions options = null)
{
if (htmlWriter == null)
throw new ArgumentNullException("htmlWriter");
this.htmlWriter = htmlWriter;
this.options = options ?? new HtmlOptions();
}
/// <inheritdoc/>
public override Encoding Encoding {
get { return htmlWriter.Encoding; }
}
/// <inheritdoc/>
public override void Flush()
{
FlushSpace(true); // next char potentially might be whitespace
htmlWriter.Flush();
}
/// <inheritdoc/>
protected override void Dispose(bool disposing)
{
if (disposing) {
FlushSpace(true);
}
base.Dispose(disposing);
}
void FlushSpace(bool nextIsWhitespace)
{
if (hasSpace) {
if (spaceNeedsEscaping || nextIsWhitespace)
htmlWriter.Write("&nbsp;");
else
htmlWriter.Write(' ');
hasSpace = false;
spaceNeedsEscaping = true;
}
}
void WriteIndentation()
{
if (needIndentation) {
for (int i = 0; i < indentationLevel; i++) {
WriteChar('\t');
}
needIndentation = false;
}
}
/// <inheritdoc/>
public override void Write(char value)
{
WriteIndentation();
WriteChar(value);
}
static readonly char[] specialChars = { ' ', '\t', '\r', '\n' };
void WriteChar(char c)
{
bool isWhitespace = char.IsWhiteSpace(c);
FlushSpace(isWhitespace);
switch (c) {
case ' ':
if (spaceNeedsEscaping)
htmlWriter.Write("&nbsp;");
else
hasSpace = true;
break;
case '\t':
for (int i = 0; i < options.TabSize; i++) {
htmlWriter.Write("&nbsp;");
}
break;
case '\r':
break; // ignore; we'll write the <br/> with the following \n
case '\n':
htmlWriter.Write("<br/>");
needIndentation = true;
break;
default:
WebUtility.HtmlEncode(c.ToString(), htmlWriter);
break;
}
// If we just handled a space by setting hasSpace = true,
// we mustn't set spaceNeedsEscaping as doing so would affect our own space,
// not just the following spaces.
if (c != ' ') {
// Following spaces must be escaped if c was a newline/tab;
// and they don't need escaping if c was a normal character.
spaceNeedsEscaping = isWhitespace;
}
}
/// <inheritdoc/>
public override void Write(string value)
{
int pos = 0;
do {
int endPos = value.IndexOfAny(specialChars, pos);
if (endPos < 0) {
WriteSimpleString(value.Substring(pos));
return; // reached end of string
}
if (endPos > pos)
WriteSimpleString(value.Substring(pos, endPos - pos));
WriteChar(value[pos]);
pos = endPos + 1;
} while (pos < value.Length);
}
void WriteIndentationAndSpace()
{
WriteIndentation();
FlushSpace(false);
}
void WriteSimpleString(string value)
{
if (value.Length == 0)
return;
WriteIndentationAndSpace();
WebUtility.HtmlEncode(value, htmlWriter);
}
/// <inheritdoc/>
public override void Indent()
{
indentationLevel++;
}
/// <inheritdoc/>
public override void Unindent()
{
if (indentationLevel == 0)
throw new NotSupportedException();
indentationLevel--;
}
/// <inheritdoc/>
protected override void BeginUnhandledSpan()
{
endTagStack.Push(null);
}
/// <inheritdoc/>
public override void EndSpan()
{
htmlWriter.Write(endTagStack.Pop());
}
/// <inheritdoc/>
public override void BeginSpan(Color foregroundColor)
{
BeginSpan(new HighlightingColor { Foreground = new SimpleHighlightingBrush(foregroundColor) });
}
/// <inheritdoc/>
public override void BeginSpan(FontFamily fontFamily)
{
BeginUnhandledSpan(); // TODO
}
/// <inheritdoc/>
public override void BeginSpan(FontStyle fontStyle)
{
BeginSpan(new HighlightingColor { FontStyle = fontStyle });
}
/// <inheritdoc/>
public override void BeginSpan(FontWeight fontWeight)
{
BeginSpan(new HighlightingColor { FontWeight = fontWeight });
}
/// <inheritdoc/>
public override void BeginSpan(HighlightingColor highlightingColor)
{
WriteIndentationAndSpace();
if (options.ColorNeedsSpanForStyling(highlightingColor)) {
htmlWriter.Write("<span");
options.WriteStyleAttributeForColor(htmlWriter, highlightingColor);
htmlWriter.Write('>');
endTagStack.Push("</span>");
} else {
endTagStack.Push(null);
}
}
/// <inheritdoc/>
public override void BeginHyperlinkSpan(Uri uri)
{
WriteIndentationAndSpace();
htmlWriter.Write("<a href=\"" + WebUtility.HtmlEncode(uri.ToString()) + "\">");
endTagStack.Push("</a>");
}
}
}

252
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/RichText.cs

@ -0,0 +1,252 @@ @@ -0,0 +1,252 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Windows.Documents;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Utils;
namespace ICSharpCode.AvalonEdit.Highlighting
{
/// <summary>
/// Represents a immutable piece text with highlighting information.
/// </summary>
public class RichText
{
/// <summary>
/// The empty string without any formatting information.
/// </summary>
public static readonly RichText Empty = new RichText(string.Empty);
readonly string text;
internal readonly int[] stateChangeOffsets;
internal readonly HighlightingColor[] stateChanges;
/// <summary>
/// Creates a RichText instance with the given text and RichTextModel.
/// </summary>
/// <param name="text">
/// The text to use in this RichText instance.
/// </param>
/// <param name="model">
/// The model that contains the formatting to use for this RichText instance.
/// <c>model.DocumentLength</c> should correspond to <c>text.Length</c>.
/// This parameter may be null, in which case the RichText instance just holds plain text.
/// </param>
public RichText(string text, RichTextModel model = null)
{
if (text == null)
throw new ArgumentNullException("text");
this.text = text;
if (model != null) {
var sections = model.GetHighlightedSections(0, text.Length).ToArray();
stateChangeOffsets = new int[sections.Length];
stateChanges = new HighlightingColor[sections.Length];
for (int i = 0; i < sections.Length; i++) {
stateChangeOffsets[i] = sections[i].Offset;
stateChanges[i] = sections[i].Color;
}
} else {
stateChangeOffsets = new int[] { 0 };
stateChanges = new HighlightingColor[] { HighlightingColor.Empty };
}
}
internal RichText(string text, int[] offsets, HighlightingColor[] states)
{
this.text = text;
Debug.Assert(offsets[0] == 0);
Debug.Assert(offsets.Last() <= text.Length);
this.stateChangeOffsets = offsets;
this.stateChanges = states;
}
/// <summary>
/// Gets the text.
/// </summary>
public string Text {
get { return text; }
}
/// <summary>
/// Gets the text length.
/// </summary>
public int Length {
get { return text.Length; }
}
int GetIndexForOffset(int offset)
{
if (offset < 0 || offset > text.Length)
throw new ArgumentOutOfRangeException("offset");
int index = Array.BinarySearch(stateChangeOffsets, offset);
if (index < 0) {
// If no color change exists directly at offset,
// return the index of the color segment that contains offset.
index = ~index - 1;
}
return index;
}
int GetEnd(int index)
{
// Gets the end of the color segment no. index.
if (index + 1 < stateChangeOffsets.Length)
return stateChangeOffsets[index + 1];
else
return text.Length;
}
/// <summary>
/// Gets the HighlightingColor for the specified offset.
/// </summary>
public HighlightingColor GetHighlightingAt(int offset)
{
return stateChanges[GetIndexForOffset(offset)];
}
/// <summary>
/// Retrieves the highlighted sections in the specified range.
/// The highlighted sections will be sorted by offset, and there will not be any nested or overlapping sections.
/// </summary>
public IEnumerable<HighlightedSection> GetHighlightedSections(int offset, int length)
{
int index = GetIndexForOffset(offset);
int pos = offset;
int endOffset = offset + length;
while (pos < endOffset) {
int endPos = Math.Min(endOffset, GetEnd(index));
yield return new HighlightedSection {
Offset = pos,
Length = endPos - pos,
Color = stateChanges[index]
};
pos = endPos;
index++;
}
}
/// <summary>
/// Creates a new RichTextModel with the formatting from this RichText.
/// </summary>
public RichTextModel ToRichTextModel()
{
return new RichTextModel(stateChangeOffsets, stateChanges);
}
/// <summary>
/// Gets the text.
/// </summary>
public override string ToString()
{
return text;
}
/// <summary>
/// Creates WPF Run instances that can be used for TextBlock.Inlines.
/// </summary>
public Run[] CreateRuns()
{
Run[] runs = new Run[stateChanges.Length];
for (int i = 0; i < runs.Length; i++) {
int startOffset = stateChangeOffsets[i];
int endOffset = i + 1 < stateChangeOffsets.Length ? stateChangeOffsets[i + 1] : text.Length;
Run r = new Run(text.Substring(startOffset, endOffset - startOffset));
HighlightingColor state = stateChanges[i];
if (state.Foreground != null)
r.Foreground = state.Foreground.GetBrush(null);
if (state.Background != null)
r.Background = state.Background.GetBrush(null);
if (state.FontWeight != null)
r.FontWeight = state.FontWeight.Value;
if (state.FontStyle != null)
r.FontStyle = state.FontStyle.Value;
runs[i] = r;
}
return runs;
}
/// <summary>
/// Produces HTML code for the line, with &lt;span style="..."&gt; tags.
/// </summary>
public string ToHtml(HtmlOptions options = null)
{
StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture);
using (var htmlWriter = new HtmlRichTextWriter(stringWriter, options)) {
htmlWriter.Write(this);
}
return stringWriter.ToString();
}
/// <summary>
/// Produces HTML code for a section of the line, with &lt;span style="..."&gt; tags.
/// </summary>
public string ToHtml(int offset, int length, HtmlOptions options = null)
{
StringWriter stringWriter = new StringWriter(CultureInfo.InvariantCulture);
using (var htmlWriter = new HtmlRichTextWriter(stringWriter, options)) {
htmlWriter.Write(this, offset, length);
}
return stringWriter.ToString();
}
/// <summary>
/// Creates a substring of this rich text.
/// </summary>
public RichText Substring(int offset, int length)
{
if (offset == 0 && length == this.Length)
return this;
string newText = text.Substring(offset, length);
RichTextModel model = ToRichTextModel();
OffsetChangeMap map = new OffsetChangeMap(2);
map.Add(new OffsetChangeMapEntry(offset + length, text.Length - offset - length, 0));
map.Add(new OffsetChangeMapEntry(0, offset, 0));
model.UpdateOffsets(map);
return new RichText(newText, model);
}
/// <summary>
/// Concatenates the specified rich texts.
/// </summary>
public static RichText Concat(params RichText[] texts)
{
if (texts == null || texts.Length == 0)
return Empty;
else if (texts.Length == 1)
return texts[0];
string newText = string.Concat(texts.Select(txt => txt.text));
RichTextModel model = texts[0].ToRichTextModel();
int offset = texts[0].Length;
for (int i = 1; i < texts.Length; i++) {
model.Append(offset, texts[i].stateChangeOffsets, texts[i].stateChanges);
offset += texts[i].Length;
}
return new RichText(newText, model);
}
/// <summary>
/// Concatenates the specified rich texts.
/// </summary>
public static RichText operator +(RichText a, RichText b)
{
return RichText.Concat(a, b);
}
/// <summary>
/// Implicit conversion from string to RichText.
/// </summary>
public static implicit operator RichText(string text)
{
if (text != null)
return new RichText(text);
else
return null;
}
}
}

39
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/RichTextColorizer.cs

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Rendering;
namespace ICSharpCode.AvalonEdit.Highlighting
{
/// <summary>
/// A colorizer that applies the highlighting from a <see cref="RichTextModel"/> to the editor.
/// </summary>
public class RichTextColorizer : DocumentColorizingTransformer
{
readonly RichTextModel richTextModel;
/// <summary>
/// Creates a new RichTextColorizer instance.
/// </summary>
public RichTextColorizer(RichTextModel richTextModel)
{
if (richTextModel == null)
throw new ArgumentNullException("richTextModel");
this.richTextModel = richTextModel;
}
/// <inheritdoc/>
protected override void ColorizeLine(DocumentLine line)
{
var sections = richTextModel.GetHighlightedSections(line.Offset, line.Length);
foreach (HighlightedSection section in sections) {
if (HighlightingColorizer.IsEmptyColor(section.Color))
continue;
ChangeLinePart(section.Offset, section.Offset + section.Length,
visualLineElement => HighlightingColorizer.ApplyColorToElement(visualLineElement, section.Color, CurrentContext));
}
}
}
}

268
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/RichTextModel.cs

@ -0,0 +1,268 @@ @@ -0,0 +1,268 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Media;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.NRefactory.TypeSystem.Implementation;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Utils;
namespace ICSharpCode.AvalonEdit.Highlighting
{
/// <summary>
/// Stores rich-text formatting.
/// </summary>
public sealed class RichTextModel : AbstractFreezable
{
List<int> stateChangeOffsets = new List<int>();
List<HighlightingColor> stateChanges = new List<HighlightingColor>();
int GetIndexForOffset(int offset)
{
if (offset < 0)
throw new ArgumentOutOfRangeException("offset");
int index = stateChangeOffsets.BinarySearch(offset);
if (index < 0) {
// If no color change exists directly at offset,
// create a new one.
index = ~index;
stateChanges.Insert(index, stateChanges[index - 1].Clone());
stateChangeOffsets.Insert(index, offset);
}
return index;
}
int GetIndexForOffsetUseExistingSegment(int offset)
{
if (offset < 0)
throw new ArgumentOutOfRangeException("offset");
int index = stateChangeOffsets.BinarySearch(offset);
if (index < 0) {
// If no color change exists directly at offset,
// return the index of the color segment that contains offset.
index = ~index - 1;
}
return index;
}
int GetEnd(int index)
{
// Gets the end of the color segment no. index.
if (index + 1 < stateChangeOffsets.Count)
return stateChangeOffsets[index + 1];
else
return int.MaxValue;
}
/// <summary>
/// Creates a new RichTextModel.
/// </summary>
public RichTextModel()
{
stateChangeOffsets.Add(0);
stateChanges.Add(new HighlightingColor());
}
/// <summary>
/// Creates a RichTextModel from a CONTIGUOUS list of HighlightedSections.
/// </summary>
internal RichTextModel(int[] stateChangeOffsets, HighlightingColor[] stateChanges)
{
Debug.Assert(stateChangeOffsets[0] == 0);
this.stateChangeOffsets.AddRange(stateChangeOffsets);
this.stateChanges.AddRange(stateChanges);
}
#region UpdateOffsets
/// <summary>
/// Updates the start and end offsets of all segments stored in this collection.
/// </summary>
/// <param name="e">TextChangeEventArgs instance describing the change to the document.</param>
public void UpdateOffsets(TextChangeEventArgs e)
{
if (e == null)
throw new ArgumentNullException("e");
UpdateOffsets(e.GetNewOffset);
}
/// <summary>
/// Updates the start and end offsets of all segments stored in this collection.
/// </summary>
/// <param name="change">OffsetChangeMap instance describing the change to the document.</param>
public void UpdateOffsets(OffsetChangeMap change)
{
if (change == null)
throw new ArgumentNullException("change");
UpdateOffsets(change.GetNewOffset);
}
/// <summary>
/// Updates the start and end offsets of all segments stored in this collection.
/// </summary>
/// <param name="change">OffsetChangeMapEntry instance describing the change to the document.</param>
public void UpdateOffsets(OffsetChangeMapEntry change)
{
UpdateOffsets(change.GetNewOffset);
}
void UpdateOffsets(Func<int, AnchorMovementType, int> updateOffset)
{
int readPos = 1;
int writePos = 1;
while (readPos < stateChangeOffsets.Count) {
Debug.Assert(writePos <= readPos);
int newOffset = updateOffset(stateChangeOffsets[readPos], AnchorMovementType.Default);
if (newOffset == stateChangeOffsets[writePos - 1]) {
// offset moved to same position as previous offset
// -> previous segment has length 0 and gets overwritten with this segment
stateChanges[writePos - 1] = stateChanges[readPos];
} else {
stateChangeOffsets[writePos] = newOffset;
stateChanges[writePos] = stateChanges[readPos];
writePos++;
}
readPos++;
}
// Delete all entries that were not written to
stateChangeOffsets.RemoveRange(writePos, stateChangeOffsets.Count - writePos);
stateChanges.RemoveRange(writePos, stateChanges.Count - writePos);
}
#endregion
/// <summary>
/// Appends another RichTextModel after this one.
/// </summary>
internal void Append(int offset, int[] newOffsets, HighlightingColor[] newColors)
{
Debug.Assert(newOffsets.Length == newColors.Length);
Debug.Assert(newOffsets[0] == 0);
// remove everything before offset:
while (stateChangeOffsets.Count > 0 && stateChangeOffsets.Last() <= offset) {
stateChangeOffsets.RemoveAt(stateChangeOffsets.Count - 1);
stateChanges.RemoveAt(stateChanges.Count - 1);
}
// Append the new segments
for (int i = 0; i < newOffsets.Length; i++) {
stateChangeOffsets.Add(offset + newOffsets[i]);
stateChanges.Add(newColors[i]);
}
}
/// <summary>
/// Gets a copy of the HighlightingColor for the specified offset.
/// </summary>
public HighlightingColor GetHighlightingAt(int offset)
{
return stateChanges[GetIndexForOffsetUseExistingSegment(offset)].Clone();
}
/// <summary>
/// Applies the HighlightingColor to the specified range of text.
/// If the color specifies <c>null</c> for some properties, existing highlighting is preserved.
/// </summary>
public void ApplyHighlighting(int offset, int length, HighlightingColor color)
{
if (color == null || color.IsEmptyForMerge) {
// Optimization: don't split the HighlightingState when we're not changing
// any property. For example, the "Punctuation" color in C# is
// empty by default.
return;
}
int startIndex = GetIndexForOffset(offset);
int endIndex = GetIndexForOffset(offset + length);
for (int i = startIndex; i < endIndex; i++) {
stateChanges[i].MergeWith(color);
}
}
/// <summary>
/// Sets the HighlightingColor for the specified range of text,
/// completely replacing the existing highlighting in that area.
/// </summary>
public void SetHighlighting(int offset, int length, HighlightingColor color)
{
if (length <= 0)
return;
int startIndex = GetIndexForOffset(offset);
int endIndex = GetIndexForOffset(offset + length);
stateChanges[startIndex] = color != null ? color.Clone() : new HighlightingColor();
stateChanges.RemoveRange(startIndex + 1, endIndex - (startIndex + 1));
stateChangeOffsets.RemoveRange(startIndex + 1, endIndex - (startIndex + 1));
}
/// <summary>
/// Sets the foreground brush on the specified text segment.
/// </summary>
public void SetForeground(int offset, int length, HighlightingBrush brush)
{
int startIndex = GetIndexForOffset(offset);
int endIndex = GetIndexForOffset(offset + length);
for (int i = startIndex; i < endIndex; i++) {
stateChanges[i].Foreground = brush;
}
}
/// <summary>
/// Sets the background brush on the specified text segment.
/// </summary>
public void SetBackground(int offset, int length, HighlightingBrush brush)
{
int startIndex = GetIndexForOffset(offset);
int endIndex = GetIndexForOffset(offset + length);
for (int i = startIndex; i < endIndex; i++) {
stateChanges[i].Background = brush;
}
}
/// <summary>
/// Sets the font weight on the specified text segment.
/// </summary>
public void SetFontWeight(int offset, int length, FontWeight weight)
{
int startIndex = GetIndexForOffset(offset);
int endIndex = GetIndexForOffset(offset + length);
for (int i = startIndex; i < endIndex; i++) {
stateChanges[i].FontWeight = weight;
}
}
/// <summary>
/// Sets the font style on the specified text segment.
/// </summary>
public void SetFontStyle(int offset, int length, FontStyle style)
{
int startIndex = GetIndexForOffset(offset);
int endIndex = GetIndexForOffset(offset + length);
for (int i = startIndex; i < endIndex; i++) {
stateChanges[i].FontStyle = style;
}
}
/// <summary>
/// Retrieves the highlighted sections in the specified range.
/// The highlighted sections will be sorted by offset, and there will not be any nested or overlapping sections.
/// </summary>
public IEnumerable<HighlightedSection> GetHighlightedSections(int offset, int length)
{
int index = GetIndexForOffsetUseExistingSegment(offset);
int pos = offset;
int endOffset = offset + length;
while (pos < endOffset) {
int endPos = Math.Min(endOffset, GetEnd(index));
yield return new HighlightedSection {
Offset = pos,
Length = endPos - pos,
Color = stateChanges[index].Clone()
};
pos = endPos;
index++;
}
}
}
}

115
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Highlighting/RichTextModelWriter.cs

@ -0,0 +1,115 @@ @@ -0,0 +1,115 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Windows;
using System.Windows.Media;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.AvalonEdit.Utils;
namespace ICSharpCode.AvalonEdit.Highlighting
{
/// <summary>
/// A RichTextWriter that writes into a document and RichTextModel.
/// </summary>
class RichTextModelWriter : PlainRichTextWriter
{
readonly RichTextModel richTextModel;
readonly DocumentTextWriter documentTextWriter;
readonly Stack<HighlightingColor> colorStack = new Stack<HighlightingColor>();
HighlightingColor currentColor;
int currentColorBegin = -1;
/// <summary>
/// Creates a new RichTextModelWriter that inserts into document, starting at insertionOffset.
/// </summary>
public RichTextModelWriter(RichTextModel richTextModel, IDocument document, int insertionOffset)
: base(new DocumentTextWriter(document, insertionOffset))
{
if (richTextModel == null)
throw new ArgumentNullException("richTextModel");
this.richTextModel = richTextModel;
this.documentTextWriter = (DocumentTextWriter)base.textWriter;
currentColor = richTextModel.GetHighlightingAt(Math.Max(0, insertionOffset - 1));
}
/// <summary>
/// Gets/Sets the current insertion offset.
/// </summary>
public int InsertionOffset {
get { return documentTextWriter.InsertionOffset; }
set { documentTextWriter.InsertionOffset = value; }
}
/// <inheritdoc/>
protected override void BeginUnhandledSpan()
{
colorStack.Push(currentColor);
}
void BeginColorSpan()
{
WriteIndentationIfNecessary();
colorStack.Push(currentColor);
currentColor = currentColor.Clone();
currentColorBegin = documentTextWriter.InsertionOffset;
}
/// <inheritdoc/>
public override void EndSpan()
{
currentColor = colorStack.Pop();
currentColorBegin = documentTextWriter.InsertionOffset;
}
/// <inheritdoc/>
protected override void AfterWrite()
{
base.AfterWrite();
richTextModel.SetHighlighting(currentColorBegin, documentTextWriter.InsertionOffset - currentColorBegin, currentColor);
}
/// <inheritdoc/>
public override void BeginSpan(Color foregroundColor)
{
BeginColorSpan();
currentColor.Foreground = new SimpleHighlightingBrush(foregroundColor);
currentColor.Freeze();
}
/// <inheritdoc/>
public override void BeginSpan(FontFamily fontFamily)
{
BeginUnhandledSpan(); // TODO
}
/// <inheritdoc/>
public override void BeginSpan(FontStyle fontStyle)
{
BeginColorSpan();
currentColor.FontStyle = fontStyle;
currentColor.Freeze();
}
/// <inheritdoc/>
public override void BeginSpan(FontWeight fontWeight)
{
BeginColorSpan();
currentColor.FontWeight = fontWeight;
currentColor.Freeze();
}
/// <inheritdoc/>
public override void BeginSpan(HighlightingColor highlightingColor)
{
BeginColorSpan();
currentColor.MergeWith(highlightingColor);
currentColor.Freeze();
}
}
}

9
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.csproj

@ -102,6 +102,7 @@ @@ -102,6 +102,7 @@
<Compile Include="Document\DocumentChangeOperation.cs">
<DependentUpon>UndoStack.cs</DependentUpon>
</Compile>
<Compile Include="Document\DocumentTextWriter.cs" />
<Compile Include="Document\ILineTracker.cs" />
<Compile Include="Document\SimpleSegment.cs" />
<Compile Include="Document\RopeTextSource.cs" />
@ -196,6 +197,8 @@ @@ -196,6 +197,8 @@
<Compile Include="Highlighting\HighlightingEngine.cs" />
<Compile Include="Highlighting\HighlightingManager.cs" />
<Compile Include="Highlighting\HtmlClipboard.cs" />
<Compile Include="Highlighting\HtmlOptions.cs" />
<Compile Include="Highlighting\HtmlRichTextWriter.cs" />
<Compile Include="Highlighting\IHighlighter.cs" />
<Compile Include="Highlighting\IHighlightingDefinition.cs" />
<Compile Include="Highlighting\HighlightingRule.cs" />
@ -204,6 +207,10 @@ @@ -204,6 +207,10 @@
<Compile Include="Highlighting\HighlightingSpan.cs" />
<Compile Include="Highlighting\IHighlightingDefinitionReferenceResolver.cs">
</Compile>
<Compile Include="Highlighting\RichText.cs" />
<Compile Include="Highlighting\RichTextColorizer.cs" />
<Compile Include="Highlighting\RichTextModel.cs" />
<Compile Include="Highlighting\RichTextModelWriter.cs" />
<Compile Include="Highlighting\Xshd\HighlightingLoader.cs" />
<Compile Include="Highlighting\Xshd\IXshdVisitor.cs" />
<Compile Include="Highlighting\Xshd\SaveXshdVisitor.cs" />
@ -354,7 +361,9 @@ @@ -354,7 +361,9 @@
<Compile Include="Utils\FileReader.cs" />
<Compile Include="Utils\NullSafeCollection.cs" />
<Compile Include="Utils\ObserveAddRemoveCollection.cs" />
<Compile Include="Utils\PlainRichTextWriter.cs" />
<Compile Include="Utils\PropertyChangedWeakEventManager.cs" />
<Compile Include="Utils\RichTextWriter.cs" />
<Compile Include="Utils\Rope.cs" />
<Compile Include="Utils\RopeNode.cs" />
<Compile Include="Utils\RopeTextReader.cs" />

1
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Search/SearchPanel.cs

@ -198,6 +198,7 @@ namespace ICSharpCode.AvalonEdit.Search @@ -198,6 +198,7 @@ namespace ICSharpCode.AvalonEdit.Search
{
if (textArea == null)
throw new ArgumentNullException("textArea");
#pragma warning disable 618
SearchPanel panel = new SearchPanel();
panel.AttachInternal(textArea);
panel.handler = new SearchInputHandler(textArea, panel);

22
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/CompressingTreeList.cs

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
#define DATACONSISTENCYTEST
using System;
using System.Collections.Generic;
using System.Diagnostics;
@ -411,8 +411,26 @@ namespace ICSharpCode.AvalonEdit.Utils @@ -411,8 +411,26 @@ namespace ICSharpCode.AvalonEdit.Utils
}
prevNode = n;
}
CheckProperties();
}
/// <summary>
/// Applies the conversion function to the elements in the specified range.
/// </summary>
public void TransformRange(int index, int length, Func<T, T> converter)
{
if (root == null)
return;
int endIndex = index + length;
int pos = index;
while (pos < endIndex) {
int endPos = Math.Min(endIndex, GetEndOfRun(pos));
T oldValue = this[pos];
T newValue = converter(oldValue);
SetRange(pos, endPos - pos, newValue);
pos = endPos;
}
}
/// <summary>
/// Inserts the specified <paramref name="item"/> at <paramref name="index"/>

125
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/PlainRichTextWriter.cs

@ -0,0 +1,125 @@ @@ -0,0 +1,125 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.IO;
using System.Text;
namespace ICSharpCode.AvalonEdit.Utils
{
/// <summary>
/// RichTextWriter implementation that writes plain text only
/// and ignores all formatted spans.
/// </summary>
class PlainRichTextWriter : RichTextWriter
{
/// <summary>
/// The text writer that was passed to the PlainRichTextWriter constructor.
/// </summary>
protected readonly TextWriter textWriter;
string indentationString = "\t";
int indentationLevel;
char prevChar;
/// <summary>
/// Creates a new PlainRichTextWriter instance that writes the text to the specified text writer.
/// </summary>
public PlainRichTextWriter(TextWriter textWriter)
{
if (textWriter == null)
throw new ArgumentNullException("textWriter");
this.textWriter = textWriter;
}
/// <summary>
/// Gets/Sets the string used to indent by one level.
/// </summary>
public string IndentationString {
get {
return indentationString;
}
set {
indentationString = value;
}
}
/// <inheritdoc/>
protected override void BeginUnhandledSpan()
{
}
/// <inheritdoc/>
public override void EndSpan()
{
}
void WriteIndentation()
{
for (int i = 0; i < indentationLevel; i++) {
textWriter.Write(indentationString);
}
}
/// <summary>
/// Writes the indentation, if necessary.
/// </summary>
protected void WriteIndentationIfNecessary()
{
if (prevChar == '\n') {
WriteIndentation();
prevChar = '\0';
}
}
/// <summary>
/// Is called after a write operation.
/// </summary>
protected virtual void AfterWrite()
{
}
/// <inheritdoc/>
public override void Write(char value)
{
if (prevChar == '\n')
WriteIndentation();
textWriter.Write(value);
prevChar = value;
AfterWrite();
}
/// <inheritdoc/>
public override void Indent()
{
indentationLevel++;
}
/// <inheritdoc/>
public override void Unindent()
{
if (indentationLevel == 0)
throw new NotSupportedException();
indentationLevel--;
}
/// <inheritdoc/>
public override Encoding Encoding {
get { return textWriter.Encoding; }
}
/// <inheritdoc/>
public override IFormatProvider FormatProvider {
get { return textWriter.FormatProvider; }
}
/// <inheritdoc/>
public override string NewLine {
get {
return textWriter.NewLine;
}
set {
textWriter.NewLine = value;
}
}
}
}

106
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Utils/RichTextWriter.cs

@ -0,0 +1,106 @@ @@ -0,0 +1,106 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.IO;
using System.Windows;
using System.Windows.Media;
using ICSharpCode.AvalonEdit.Highlighting;
namespace ICSharpCode.AvalonEdit.Utils
{
/// <summary>
/// A text writer that supports creating spans of highlighted text.
/// </summary>
abstract class RichTextWriter : TextWriter
{
/// <summary>
/// Gets called by the RichTextWriter base class when a BeginSpan() method
/// that is not overwritten gets called.
/// </summary>
protected abstract void BeginUnhandledSpan();
/// <summary>
/// Writes the RichText instance.
/// </summary>
public void Write(RichText richText)
{
Write(richText, 0, richText.Length);
}
/// <summary>
/// Writes the RichText instance.
/// </summary>
public virtual void Write(RichText richText, int offset, int length)
{
foreach (var section in richText.GetHighlightedSections(offset, length)) {
BeginSpan(section.Color);
Write(richText.Text.Substring(section.Offset, section.Length));
EndSpan();
}
}
/// <summary>
/// Begin a colored span.
/// </summary>
public virtual void BeginSpan(Color foregroundColor)
{
BeginUnhandledSpan();
}
/// <summary>
/// Begin a span with modified font weight.
/// </summary>
public virtual void BeginSpan(FontWeight fontWeight)
{
BeginUnhandledSpan();
}
/// <summary>
/// Begin a span with modified font style.
/// </summary>
public virtual void BeginSpan(FontStyle fontStyle)
{
BeginUnhandledSpan();
}
/// <summary>
/// Begin a span with modified font family.
/// </summary>
public virtual void BeginSpan(FontFamily fontFamily)
{
BeginUnhandledSpan();
}
/// <summary>
/// Begin a highlighted span.
/// </summary>
public virtual void BeginSpan(Highlighting.HighlightingColor highlightingColor)
{
BeginUnhandledSpan();
}
/// <summary>
/// Begin a span that links to the specified URI.
/// </summary>
public virtual void BeginHyperlinkSpan(Uri uri)
{
BeginUnhandledSpan();
}
/// <summary>
/// Marks the end of the current span.
/// </summary>
public abstract void EndSpan();
/// <summary>
/// Increases the indentation level.
/// </summary>
public abstract void Indent();
/// <summary>
/// Decreases the indentation level.
/// </summary>
public abstract void Unindent();
}
}

439
src/Libraries/AvalonEdit/ICSharpCode.AvalonEdit/Xml/TagMatchingHeuristics.cs

@ -1,439 +0,0 @@ @@ -1,439 +0,0 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ICSharpCode.AvalonEdit.Utils;
using ICSharpCode.NRefactory.Utils;
namespace ICSharpCode.AvalonEdit.Xml
{
class TagMatchingHeuristics
{
const int maxConfigurationCount = 10;
AXmlParser parser;
TrackedSegmentCollection trackedSegments;
string input;
List<AXmlObject> tags;
public TagMatchingHeuristics(AXmlParser parser, string input, List<AXmlObject> tags)
{
this.parser = parser;
this.trackedSegments = parser.TrackedSegments;
this.input = input;
this.tags = tags;
}
public AXmlDocument ReadDocument()
{
AXmlDocument doc = new AXmlDocument() { Parser = parser };
// AXmlParser.Log("Flat stream: {0}", PrintObjects(tags));
List<AXmlObject> valid = MatchTags(tags);
// AXmlParser.Log("Fixed stream: {0}", PrintObjects(valid));
IEnumerator<AXmlObject> validStream = valid.GetEnumerator();
validStream.MoveNext(); // Move to first
while(true) {
// End of stream?
try {
if (validStream.Current == null) break;
} catch (InvalidCastException) {
break;
}
doc.AddChild(ReadTextOrElement(validStream));
}
if (doc.Children.Count > 0) {
doc.StartOffset = doc.FirstChild.StartOffset;
doc.EndOffset = doc.LastChild.EndOffset;
}
// Check well formed
foreach(AXmlTag xmlDeclaration in doc.Children.OfType<AXmlTag>().Where(t => t.IsProcessingInstruction && string.Equals(t.Name, "xml", StringComparison.OrdinalIgnoreCase))) {
if (xmlDeclaration.StartOffset != 0)
TagReader.OnSyntaxError(doc, xmlDeclaration.StartOffset, xmlDeclaration.StartOffset + 5,
"XML declaration must be at the start of document");
}
int elemCount = doc.Children.OfType<AXmlElement>().Count();
if (elemCount == 0)
TagReader.OnSyntaxError(doc, doc.EndOffset, doc.EndOffset,
"Root element is missing");
if (elemCount > 1) {
AXmlElement next = doc.Children.OfType<AXmlElement>().Skip(1).First();
TagReader.OnSyntaxError(doc, next.StartOffset, next.StartOffset,
"Only one root element is allowed");
}
foreach(AXmlTag tag in doc.Children.OfType<AXmlTag>()) {
if (tag.IsCData)
TagReader.OnSyntaxError(doc, tag.StartOffset, tag.EndOffset,
"CDATA not allowed in document root");
}
foreach(AXmlText text in doc.Children.OfType<AXmlText>()) {
if (!text.ContainsOnlyWhitespace)
TagReader.OnSyntaxError(doc, text.StartOffset, text.EndOffset,
"Only whitespace is allowed in document root");
}
AXmlParser.Log("Constructed {0}", doc);
trackedSegments.AddParsedObject(doc, null);
return doc;
}
static AXmlObject ReadSingleObject(IEnumerator<AXmlObject> objStream)
{
AXmlObject obj = objStream.Current;
objStream.MoveNext();
return obj;
}
AXmlObject ReadTextOrElement(IEnumerator<AXmlObject> objStream)
{
AXmlObject curr = objStream.Current;
if (curr is AXmlText || curr is AXmlElement) {
return ReadSingleObject(objStream);
} else {
AXmlTag currTag = (AXmlTag)curr;
if (currTag == StartTagPlaceholder) {
return ReadElement(objStream);
} else if (currTag.IsStartOrEmptyTag) {
return ReadElement(objStream);
} else {
return ReadSingleObject(objStream);
}
}
}
AXmlElement ReadElement(IEnumerator<AXmlObject> objStream)
{
AXmlElement element = new AXmlElement();
element.IsProperlyNested = true;
// Read start tag
AXmlTag startTag = ReadSingleObject(objStream) as AXmlTag;
AXmlParser.DebugAssert(startTag != null, "Start tag expected");
AXmlParser.DebugAssert(startTag.IsStartOrEmptyTag || startTag == StartTagPlaceholder, "Start tag expected");
if (startTag == StartTagPlaceholder) {
element.HasStartOrEmptyTag = false;
element.IsProperlyNested = false;
TagReader.OnSyntaxError(element, objStream.Current.StartOffset, objStream.Current.EndOffset,
"Matching openning tag was not found");
} else {
element.HasStartOrEmptyTag = true;
element.AddChild(startTag);
}
// Read content and end tag
if (startTag == StartTagPlaceholder || // Check first in case the start tag is null
element.StartTag.IsStartTag)
{
while(true) {
AXmlTag currTag = objStream.Current as AXmlTag; // Peek
if (currTag == EndTagPlaceholder) {
TagReader.OnSyntaxError(element, element.LastChild.EndOffset, element.LastChild.EndOffset,
"Expected '</{0}>'", element.StartTag.Name);
ReadSingleObject(objStream);
element.HasEndTag = false;
element.IsProperlyNested = false;
break;
} else if (currTag != null && currTag.IsEndTag) {
if (element.HasStartOrEmptyTag && currTag.Name != element.StartTag.Name) {
TagReader.OnSyntaxError(element, currTag.StartOffset + 2, currTag.StartOffset + 2 + currTag.Name.Length,
"Expected '{0}'. End tag must have same name as start tag.", element.StartTag.Name);
}
element.AddChild(ReadSingleObject(objStream));
element.HasEndTag = true;
break;
}
AXmlObject nested = ReadTextOrElement(objStream);
AXmlElement nestedAsElement = nested as AXmlElement;
if (nestedAsElement != null) {
if (!nestedAsElement.IsProperlyNested)
element.IsProperlyNested = false;
element.AddChildren(Split(nestedAsElement).ToList());
} else {
element.AddChild(nested);
}
}
} else {
element.HasEndTag = false;
}
element.StartOffset = element.FirstChild.StartOffset;
element.EndOffset = element.LastChild.EndOffset;
AXmlParser.Assert(element.HasStartOrEmptyTag || element.HasEndTag, "Must have at least start or end tag");
AXmlParser.Log("Constructed {0}", element);
trackedSegments.AddParsedObject(element, null); // Need all elements in cache for offset tracking
return element;
}
IEnumerable<AXmlObject> Split(AXmlElement elem)
{
int myIndention = GetIndentLevel(elem);
// Has start tag and no end tag ? (other then empty-element tag)
if (elem.HasStartOrEmptyTag && elem.StartTag.IsStartTag && !elem.HasEndTag && myIndention != -1) {
int lastAccepted = 0; // Accept start tag
while (lastAccepted + 1 < elem.Children.Count) {
AXmlObject nextItem = elem.Children[lastAccepted + 1];
if (nextItem is AXmlText) {
lastAccepted++; continue; // Accept
} else {
// Include all more indented items
if (GetIndentLevel(nextItem) > myIndention) {
lastAccepted++; continue; // Accept
} else {
break; // Reject
}
}
}
// Accepted everything?
if (lastAccepted + 1 == elem.Children.Count) {
yield return elem;
yield break;
}
AXmlParser.Log("Splitting {0} - take {1} of {2} nested", elem, lastAccepted, elem.Children.Count - 1);
AXmlElement topHalf = new AXmlElement();
topHalf.HasStartOrEmptyTag = elem.HasStartOrEmptyTag;
topHalf.HasEndTag = elem.HasEndTag;
topHalf.AddChildren(elem.Children.Take(1 + lastAccepted)); // Start tag + nested
topHalf.StartOffset = topHalf.FirstChild.StartOffset;
topHalf.EndOffset = topHalf.LastChild.EndOffset;
TagReader.OnSyntaxError(topHalf, topHalf.LastChild.EndOffset, topHalf.LastChild.EndOffset,
"Expected '</{0}>'", topHalf.StartTag.Name);
AXmlParser.Log("Constructed {0}", topHalf);
trackedSegments.AddParsedObject(topHalf, null);
yield return topHalf;
for(int i = lastAccepted + 1; i < elem.Children.Count; i++) {
yield return elem.Children[i];
}
} else {
yield return elem;
}
}
int GetIndentLevel(AXmlObject obj)
{
int offset = obj.StartOffset - 1;
int level = 0;
while(true) {
if (offset < 0) break;
char c = input[offset];
if (c == ' ') {
level++;
} else if (c == '\t') {
level += 4;
} else if (c == '\r' || c == '\n') {
break;
} else {
return -1;
}
offset--;
}
return level;
}
/// <summary>
/// Stack of still unmatched start tags.
/// It includes the cost and backtack information.
/// </summary>
class Configuration
{
/// <summary> Unmatched start tags </summary>
public ImmutableStack<AXmlTag> StartTags { get; set; }
/// <summary> Properly nested tags </summary>
public ImmutableStack<AXmlObject> Document { get; set; }
/// <summary> Number of needed modificaitons to the document </summary>
public int Cost { get; set; }
}
/// <summary>
/// Dictionary which stores the cheapest configuration
/// </summary>
class Configurations: Dictionary<ImmutableStack<AXmlTag>, Configuration>
{
public Configurations()
{
}
public Configurations(IEnumerable<Configuration> configs)
{
foreach(Configuration config in configs) {
this.Add(config);
}
}
/// <summary> Overwrite only if cheaper </summary>
public void Add(Configuration newConfig)
{
Configuration oldConfig;
if (this.TryGetValue(newConfig.StartTags, out oldConfig)) {
if (newConfig.Cost < oldConfig.Cost) {
this[newConfig.StartTags] = newConfig;
}
} else {
base.Add(newConfig.StartTags, newConfig);
}
}
public override string ToString()
{
StringBuilder sb = new StringBuilder();
foreach(var kvp in this) {
sb.Append("\n - '");
foreach(AXmlTag startTag in kvp.Value.StartTags.Reverse()) {
sb.Append('<');
sb.Append(startTag.Name);
sb.Append('>');
}
sb.AppendFormat("' = {0}", kvp.Value.Cost);
}
return sb.ToString();
}
}
// Tags used to guide the element creation
readonly AXmlTag StartTagPlaceholder = new AXmlTag();
readonly AXmlTag EndTagPlaceholder = new AXmlTag();
/// <summary>
/// Add start or end tag placeholders so that the documment is properly nested
/// </summary>
List<AXmlObject> MatchTags(IEnumerable<AXmlObject> objs)
{
Configurations configurations = new Configurations();
configurations.Add(new Configuration {
StartTags = ImmutableStack<AXmlTag>.Empty,
Document = ImmutableStack<AXmlObject>.Empty,
Cost = 0,
});
foreach(AXmlObject obj in objs) {
configurations = ProcessObject(configurations, obj);
}
// Close any remaining start tags
foreach(Configuration conifg in configurations.Values) {
while(!conifg.StartTags.IsEmpty) {
conifg.StartTags = conifg.StartTags.Pop();
conifg.Document = conifg.Document.Push(EndTagPlaceholder);
conifg.Cost += 1;
}
}
// AXmlParser.Log("Configurations after closing all remaining tags:" + configurations.ToString());
Configuration bestConfig = configurations.Values.OrderBy(v => v.Cost).First();
AXmlParser.Log("Best configuration has cost {0}", bestConfig.Cost);
return bestConfig.Document.Reverse().ToList();
}
/// <summary> Get posible configurations after considering given object </summary>
Configurations ProcessObject(Configurations oldConfigs, AXmlObject obj)
{
AXmlParser.Log("Processing {0}", obj);
AXmlTag objAsTag = obj as AXmlTag;
AXmlElement objAsElement = obj as AXmlElement;
AXmlParser.DebugAssert(objAsTag != null || objAsElement != null || obj is AXmlText, obj.GetType().Name + " not expected");
if (objAsElement != null)
AXmlParser.Assert(objAsElement.IsProperlyNested, "Element not properly nested");
Configurations newConfigs = new Configurations();
foreach(var kvp in oldConfigs) {
Configuration oldConfig = kvp.Value;
var oldStartTags = oldConfig.StartTags;
var oldDocument = oldConfig.Document;
int oldCost = oldConfig.Cost;
if (objAsTag != null && objAsTag.IsStartTag) {
newConfigs.Add(new Configuration { // Push start-tag (cost 0)
StartTags = oldStartTags.Push(objAsTag),
Document = oldDocument.Push(objAsTag),
Cost = oldCost,
});
} else if (objAsTag != null && objAsTag.IsEndTag) {
newConfigs.Add(new Configuration { // Ignore (cost 1)
StartTags = oldStartTags,
Document = oldDocument.Push(StartTagPlaceholder).Push(objAsTag),
Cost = oldCost + 1,
});
if (!oldStartTags.IsEmpty && oldStartTags.Peek().Name != objAsTag.Name) {
newConfigs.Add(new Configuration { // Pop 1 item (cost 1) - not mathcing
StartTags = oldStartTags.Pop(),
Document = oldDocument.Push(objAsTag),
Cost = oldCost + 1,
});
}
int popedCount = 0;
var startTags = oldStartTags;
var doc = oldDocument;
foreach(AXmlTag poped in oldStartTags) {
popedCount++;
if (poped.Name == objAsTag.Name) {
newConfigs.Add(new Configuration { // Pop 'x' items (cost x-1) - last one is matching
StartTags = startTags.Pop(),
Document = doc.Push(objAsTag),
Cost = oldCost + popedCount - 1,
});
}
startTags = startTags.Pop();
doc = doc.Push(EndTagPlaceholder);
}
} else {
// Empty tag or other tag type or text or properly nested element
newConfigs.Add(new Configuration { // Ignore (cost 0)
StartTags = oldStartTags,
Document = oldDocument.Push(obj),
Cost = oldCost,
});
}
}
// Log("New configurations:" + newConfigs.ToString());
Configurations bestNewConfigurations = new Configurations(
newConfigs.Values.OrderBy(v => v.Cost).Take(maxConfigurationCount)
);
// AXmlParser.Log("Best new configurations:" + bestNewConfigurations.ToString());
return bestNewConfigurations;
}
#region Helper methods
/*
string PrintObjects(IEnumerable<AXmlObject> objs)
{
StringBuilder sb = new StringBuilder();
foreach(AXmlObject obj in objs) {
if (obj is AXmlTag) {
if (obj == StartTagPlaceholder) {
sb.Append("#StartTag#");
} else if (obj == EndTagPlaceholder) {
sb.Append("#EndTag#");
} else {
sb.Append(((AXmlTag)obj).OpeningBracket);
sb.Append(((AXmlTag)obj).Name);
sb.Append(((AXmlTag)obj).ClosingBracket);
}
} else if (obj is AXmlElement) {
sb.Append('[');
sb.Append(PrintObjects(((AXmlElement)obj).Children));
sb.Append(']');
} else if (obj is AXmlText) {
sb.Append('~');
} else {
throw new InternalException("Should not be here: " + obj);
}
}
return sb.ToString();
}
*/
#endregion
}
}

7
src/Libraries/NRefactory/ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs

@ -35,7 +35,7 @@ using ICSharpCode.NRefactory.TypeSystem; @@ -35,7 +35,7 @@ using ICSharpCode.NRefactory.TypeSystem;
namespace ICSharpCode.NRefactory.CSharp
{
public abstract class AstNode : AbstractAnnotatable, ICSharpCode.NRefactory.TypeSystem.IFreezable, PatternMatching.INode
public abstract class AstNode : AbstractAnnotatable, ICSharpCode.NRefactory.TypeSystem.IFreezable, PatternMatching.INode, ICloneable
{
// the Root role must be available when creating the null nodes, so we can't put it in the Roles class
internal static readonly Role<AstNode> RootRole = new Role<AstNode> ("Root");
@ -613,6 +613,11 @@ namespace ICSharpCode.NRefactory.CSharp @@ -613,6 +613,11 @@ namespace ICSharpCode.NRefactory.CSharp
return copy;
}
object ICloneable.Clone()
{
return Clone();
}
public abstract void AcceptVisitor (IAstVisitor visitor);
public abstract T AcceptVisitor<T> (IAstVisitor<T> visitor);

3
src/Libraries/NRefactory/ICSharpCode.NRefactory/Properties/GlobalAssemblyInfo.cs

@ -40,5 +40,6 @@ using System.Runtime.InteropServices; @@ -40,5 +40,6 @@ using System.Runtime.InteropServices;
[assembly: AssemblyVersion("5.0.0.0")]
// [AssemblyFileVersion] is the version of the NuGet package,
// should follow http://semver.org/ rules
// Versions with breaking changes / new features should increment the 'minor' (2nd) number.
// Bugfix releases should increment the 'build' (3rd) number.
[assembly: AssemblyFileVersion("5.3.0")]

19
src/Libraries/NRefactory/ICSharpCode.NRefactory/TypeSystem/Implementation/AbstractFreezable.cs

@ -59,6 +59,25 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -59,6 +59,25 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
if (f != null)
f.Freeze();
}
public static T FreezeAndReturn<T>(T item) where T : IFreezable
{
item.Freeze();
return item;
}
/// <summary>
/// If the item is not frozen, this method creates and returns a frozen clone.
/// If the item is already frozen, it is returned without creating a clone.
/// </summary>
public static T GetFrozenClone<T>(T item) where T : IFreezable, ICloneable
{
if (!item.IsFrozen) {
item = (T)item.Clone();
item.Freeze();
}
return item;
}
}
[Serializable]

6
src/Libraries/SharpTreeView/ICSharpCode.TreeView/SharpTreeView.cs

@ -240,16 +240,20 @@ namespace ICSharpCode.TreeView @@ -240,16 +240,20 @@ namespace ICSharpCode.TreeView
break;
case Key.Return:
if (container != null && Keyboard.Modifiers == ModifierKeys.None && this.SelectedItems.Count == 1 && this.SelectedItem == container.Node) {
e.Handled = true;
container.Node.ActivateItem(e);
}
break;
case Key.Space:
if (container != null && Keyboard.Modifiers == ModifierKeys.None && this.SelectedItems.Count == 1 && this.SelectedItem == container.Node) {
if(container.Node.IsCheckable) {
e.Handled = true;
if (container.Node.IsCheckable) {
if(container.Node.IsChecked == null) // If partially selected, we want to select everything
container.Node.IsChecked = true;
else
container.Node.IsChecked = !container.Node.IsChecked;
} else {
container.Node.ActivateItem(e);
}
}
break;

27
src/Main/Base/Project/Dom/ClassBrowser/AssemblyLoadErrorTreeNode.cs

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using ICSharpCode.Core.Presentation;
using ICSharpCode.TreeView;
namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser
{
public class AssemblyLoadErrorTreeNode : SharpTreeNode
{
public override object Text {
get {
return "(Assembly not loadable)";
}
}
public override object Icon {
get {
return null;
}
}
}
}

11
src/Main/Base/Project/Dom/ClassBrowser/AssemblyTreeNode.cs

@ -36,6 +36,17 @@ namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser @@ -36,6 +36,17 @@ namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser
}
}
protected override void LoadChildren()
{
Children.Clear();
if (model.Context.IsValid) {
base.LoadChildren();
} else {
// This assembly could not be loaded correctly, add sub-node with error text
Children.Add(new AssemblyLoadErrorTreeNode());
}
}
public override object Text {
get {
return model.AssemblyName;

2
src/Main/Base/Project/Dom/ClassBrowser/IClassBrowser.cs

@ -21,7 +21,7 @@ namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser @@ -21,7 +21,7 @@ namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser
public AssemblyList()
{
Name = "<default>";
Assemblies = new SimpleModelCollection<IAssemblyModel>();
Assemblies = new NullSafeSimpleModelCollection<IAssemblyModel>();
}
}
}

4
src/Main/Base/Project/Dom/ClassBrowser/TypeDefinitionTreeNode.cs

@ -3,10 +3,12 @@ @@ -3,10 +3,12 @@
using System;
using System.Collections.Generic;
using System.Security.Policy;
using ICSharpCode.Core.Presentation;
using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.NRefactory.Utils;
using ICSharpCode.TreeView;
using ICSharpCode.SharpDevelop.Dom;
namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser
{
@ -48,7 +50,7 @@ namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser @@ -48,7 +50,7 @@ namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser
protected override IModelCollection<object> ModelChildren {
get {
return definition.Members;
return definition.NestedTypes.Concat<object>(definition.Members);
}
}

39
src/Main/Base/Project/Dom/IModelCollection.cs

@ -7,45 +7,6 @@ using System.Linq; @@ -7,45 +7,6 @@ using System.Linq;
namespace ICSharpCode.SharpDevelop.Dom
{
/// <summary>
/// Event handler for the <see cref="IModelCollection{T}.CollectionChanged"/> event.
/// </summary>
/// <remarks>
/// We don't use the classic 'EventArgs' model for this event, because a EventArgs-class couldn't be covariant.
/// </remarks>
public delegate void ModelCollectionChangedEventHandler<in T>(IReadOnlyCollection<T> removedItems, IReadOnlyCollection<T> addedItems);
public class ModelCollectionChangedEvent<T>
{
List<ModelCollectionChangedEventHandler<T>> _handlers = new List<ModelCollectionChangedEventHandler<T>>();
public void AddHandler(ModelCollectionChangedEventHandler<T> handler)
{
_handlers.Add(handler);
}
public void RemoveHandler(ModelCollectionChangedEventHandler<T> handler)
{
_handlers.Remove(handler);
}
public void Fire(IReadOnlyCollection<T> removedItems, IReadOnlyCollection<T> addedItems)
{
foreach (var handler in _handlers) {
if (handler != null) {
handler(removedItems, addedItems);
}
}
}
public bool ContainsHandlers
{
get {
return _handlers.Count > 0;
}
}
}
/// <summary>
/// A read-only collection that provides change notifications.
/// </summary>

52
src/Main/Base/Project/Dom/ModelCollectionChangedEvent.cs

@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Linq;
namespace ICSharpCode.SharpDevelop.Dom
{
/// <summary>
/// Event handler for the <see cref="IModelCollection{T}.CollectionChanged"/> event.
/// </summary>
/// <remarks>
/// We don't use the classic 'EventArgs' model for this event, because a EventArgs-class couldn't be covariant.
/// </remarks>
public delegate void ModelCollectionChangedEventHandler<in T>(IReadOnlyCollection<T> removedItems, IReadOnlyCollection<T> addedItems);
/// <summary>
/// Helper class for <see cref="IModelCollection.CollectionChanged"/> implementations.
/// This is necessary because <c>Delegate.Combine</c> does not work with
/// co-/contravariant delegates.
/// </summary>
public class ModelCollectionChangedEvent<T>
{
List<ModelCollectionChangedEventHandler<T>> _handlers = new List<ModelCollectionChangedEventHandler<T>>();
public void AddHandler(ModelCollectionChangedEventHandler<T> handler)
{
if (handler != null)
_handlers.Add(handler);
}
public void RemoveHandler(ModelCollectionChangedEventHandler<T> handler)
{
_handlers.Remove(handler);
}
public void Fire(IReadOnlyCollection<T> removedItems, IReadOnlyCollection<T> addedItems)
{
foreach (var handler in _handlers.ToArray()) {
handler(removedItems, addedItems);
}
}
public bool ContainsHandlers {
get {
return _handlers.Count > 0;
}
}
}
}

59
src/Main/Base/Project/Dom/ModelFactoryExtensions.cs

@ -0,0 +1,59 @@ @@ -0,0 +1,59 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Linq;
using System.IO;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.TypeSystem;
namespace ICSharpCode.SharpDevelop.Dom
{
public static class ModelFactoryExtensions
{
/// <summary>
/// Creates an <see cref="ICSharpCode.SharpDevelop.Dom.IAssemblyModel"/> from a file name.
/// </summary>
/// <param name="modelFactory">Model factory.</param>
/// <param name="fileName">Assembly file name.</param>
/// <returns>Created <see cref="ICSharpCode.SharpDevelop.Dom.IAssemblyModel"/>.</returns>
public static IAssemblyModel CreateAssemblyModelFromFile(this IModelFactory modelFactory, string fileName)
{
var loader = new CecilLoader();
loader.IncludeInternalMembers = true;
loader.LazyLoad = true;
var assembly = loader.LoadAssemblyFile(fileName);
IEntityModelContext context = new AssemblyEntityModelContext(assembly);
IAssemblyModel model = modelFactory.CreateAssemblyModel(context);
if (model is IUpdateableAssemblyModel) {
((IUpdateableAssemblyModel)model).Update(EmptyList<IUnresolvedTypeDefinition>.Instance, assembly.TopLevelTypeDefinitions.ToList());
((IUpdateableAssemblyModel) model).AssemblyName = assembly.AssemblyName;
}
return model;
}
/// <summary>
/// Creates an <see cref="ICSharpCode.SharpDevelop.Dom.IAssemblyModel"/> from a file name and catches
/// errors by showing messages to user.
/// </summary>
/// <param name="modelFactory">Model factory.</param>
/// <param name="fileName">Assembly file name.</param>
/// <returns>
/// Created <see cref="ICSharpCode.SharpDevelop.Dom.IAssemblyModel"/> or <b>null</b>,
/// if model couldn't be created.
/// </returns>
public static IAssemblyModel SafelyCreateAssemblyModelFromFile(this IModelFactory modelFactory, string fileName)
{
try {
return modelFactory.CreateAssemblyModelFromFile(fileName);
} catch (BadImageFormatException) {
SD.MessageService.ShowWarningFormatted("${res:ICSharpCode.SharpDevelop.Dom.AssemblyInvalid}", Path.GetFileName(fileName));
} catch (FileNotFoundException) {
SD.MessageService.ShowWarningFormatted("${res:ICSharpCode.SharpDevelop.Dom.AssemblyNotAccessible}", fileName);
}
return null;
}
}
}

30
src/Main/Base/Project/Dom/SimpleModelCollection.cs

@ -16,7 +16,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -16,7 +16,7 @@ namespace ICSharpCode.SharpDevelop.Dom
/// </summary>
public class SimpleModelCollection<T> : IMutableModelCollection<T>
{
readonly ModelCollectionChangedEvent<T> collectionChangedEvent;
readonly ModelCollectionChangedEvent<T> collectionChangedEvent = new ModelCollectionChangedEvent<T>();
readonly List<T> list;
List<T> addedItems;
List<T> removedItems;
@ -24,13 +24,13 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -24,13 +24,13 @@ namespace ICSharpCode.SharpDevelop.Dom
public SimpleModelCollection()
{
this.list = new List<T>();
collectionChangedEvent = new ModelCollectionChangedEvent<T>();
}
public SimpleModelCollection(IEnumerable<T> items)
{
this.list = new List<T>(items);
collectionChangedEvent = new ModelCollectionChangedEvent<T>();
// Note: intentionally not using ValidateItem(), as calling a virtual method
// from a constructor is problematic
}
protected void CheckReentrancy()
@ -39,6 +39,9 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -39,6 +39,9 @@ namespace ICSharpCode.SharpDevelop.Dom
throw new InvalidOperationException("Cannot modify the collection from within the CollectionChanged event.");
}
/// <summary>
/// Called before an item
/// </summary>
protected virtual void ValidateItem(T item)
{
}
@ -182,15 +185,20 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -182,15 +185,20 @@ namespace ICSharpCode.SharpDevelop.Dom
if (items == null)
throw new ArgumentNullException("items");
CheckReentrancy();
List<T> itemsList = items.ToList();
for (int i = 0; i < itemsList.Count; i++) {
ValidateItem(itemsList[i]);
}
for (int i = 0; i < itemsList.Count; i++) {
OnAdd(itemsList[i]);
try {
foreach (T item in items) {
// Add each item before validating the next,
// this is necessary because ValidateItem() might be checking
// for duplicates (e.g. KeyedModelCollection<,>)
ValidateItem(item);
OnAdd(item);
list.Add(item);
}
} finally {
// In case validation fails, we still need to raise the event
// for the items that were added successfully.
RaiseEventIfNotInBatch();
}
list.AddRange(itemsList);
RaiseEventIfNotInBatch();
}
public bool Remove(T item)

13
src/Main/Base/Project/Dom/SynchronizedModelCollection.cs

@ -31,10 +31,17 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -31,10 +31,17 @@ namespace ICSharpCode.SharpDevelop.Dom
this.syncRoot = syncRoot;
}
// Event registration is thread-safe on the underlying collection
public event ModelCollectionChangedEventHandler<T> CollectionChanged {
add { underlyingCollection.CollectionChanged += value; }
remove { underlyingCollection.CollectionChanged -= value; }
add {
lock (syncRoot) {
underlyingCollection.CollectionChanged += value;
}
}
remove {
lock (syncRoot) {
underlyingCollection.CollectionChanged -= value;
}
}
}
#region IMutableModelCollection implementation

35
src/Main/Base/Project/Editor/Search/SearchResultMatch.cs

@ -22,7 +22,7 @@ namespace ICSharpCode.SharpDevelop.Editor.Search @@ -22,7 +22,7 @@ namespace ICSharpCode.SharpDevelop.Editor.Search
int length;
TextLocation startLocation;
TextLocation endLocation;
HighlightedInlineBuilder builder;
RichText displayText;
HighlightingColor defaultTextColor;
public FileName FileName {
@ -37,10 +37,6 @@ namespace ICSharpCode.SharpDevelop.Editor.Search @@ -37,10 +37,6 @@ namespace ICSharpCode.SharpDevelop.Editor.Search
get { return endLocation; }
}
public HighlightedInlineBuilder Builder {
get { return builder; }
}
public HighlightingColor DefaultTextColor {
get { return defaultTextColor; }
}
@ -62,7 +58,7 @@ namespace ICSharpCode.SharpDevelop.Editor.Search @@ -62,7 +58,7 @@ namespace ICSharpCode.SharpDevelop.Editor.Search
return pattern;
}
public SearchResultMatch(FileName fileName, TextLocation startLocation, TextLocation endLocation, int offset, int length, HighlightedInlineBuilder builder, HighlightingColor defaultTextColor)
public SearchResultMatch(FileName fileName, TextLocation startLocation, TextLocation endLocation, int offset, int length, RichText displayText, HighlightingColor defaultTextColor)
{
if (fileName == null)
throw new ArgumentNullException("fileName");
@ -71,7 +67,7 @@ namespace ICSharpCode.SharpDevelop.Editor.Search @@ -71,7 +67,7 @@ namespace ICSharpCode.SharpDevelop.Editor.Search
this.endLocation = endLocation;
this.offset = offset;
this.length = length;
this.builder = builder;
this.displayText = displayText;
this.defaultTextColor = defaultTextColor;
}
@ -90,9 +86,9 @@ namespace ICSharpCode.SharpDevelop.Editor.Search @@ -90,9 +86,9 @@ namespace ICSharpCode.SharpDevelop.Editor.Search
/// <summary>
/// Gets a special text to display, or null to display the line's content.
/// </summary>
public virtual string DisplayText {
public RichText DisplayText {
get {
return null;
return displayText;
}
}
@ -104,29 +100,12 @@ namespace ICSharpCode.SharpDevelop.Editor.Search @@ -104,29 +100,12 @@ namespace ICSharpCode.SharpDevelop.Editor.Search
}
}
public class SimpleSearchResultMatch : SearchResultMatch
{
string displayText;
public override string DisplayText {
get {
return displayText;
}
}
public SimpleSearchResultMatch(FileName fileName, TextLocation position, int offset, string displayText)
: base(fileName, position, position, offset, 0, null, null)
{
this.displayText = displayText;
}
}
public class AvalonEditSearchResultMatch : SearchResultMatch
{
ICSharpCode.AvalonEdit.Search.ISearchResult match;
public AvalonEditSearchResultMatch(FileName fileName, TextLocation startLocation, TextLocation endLocation, int offset, int length, HighlightedInlineBuilder builder, HighlightingColor defaultTextColor, ICSharpCode.AvalonEdit.Search.ISearchResult match)
: base(fileName, startLocation, endLocation, offset, length, builder, defaultTextColor)
public AvalonEditSearchResultMatch(FileName fileName, TextLocation startLocation, TextLocation endLocation, int offset, int length, RichText richText, HighlightingColor defaultTextColor, ICSharpCode.AvalonEdit.Search.ISearchResult match)
: base(fileName, startLocation, endLocation, offset, length, richText, defaultTextColor)
{
this.match = match;
}

14
src/Main/Base/Project/Editor/Search/SearchResultsPad.cs

@ -149,24 +149,26 @@ namespace ICSharpCode.SharpDevelop.Editor.Search @@ -149,24 +149,26 @@ namespace ICSharpCode.SharpDevelop.Editor.Search
return new DummySearchResult { Text = title };
}
public static HighlightedInlineBuilder CreateInlineBuilder(TextLocation startPosition, TextLocation endPosition, IDocument document, IHighlighter highlighter)
public static RichText CreateInlineBuilder(TextLocation startPosition, TextLocation endPosition, IDocument document, IHighlighter highlighter)
{
if (startPosition.Line >= 1 && startPosition.Line <= document.LineCount) {
var inlineBuilder = highlighter.HighlightLine(startPosition.Line).ToInlineBuilder();
var highlightedLine = highlighter.HighlightLine(startPosition.Line);
var documentLine = highlightedLine.DocumentLine;
var inlineBuilder = highlightedLine.ToRichTextModel();
// reset bold/italics
inlineBuilder.SetFontWeight(0, inlineBuilder.Text.Length, FontWeights.Normal);
inlineBuilder.SetFontStyle(0, inlineBuilder.Text.Length, FontStyles.Normal);
inlineBuilder.SetFontWeight(0, documentLine.Length, FontWeights.Normal);
inlineBuilder.SetFontStyle(0, documentLine.Length, FontStyles.Normal);
// now highlight the match in bold
if (startPosition.Column >= 1) {
if (endPosition.Line == startPosition.Line && endPosition.Column > startPosition.Column) {
// subtract one from the column to get the offset inside the line's text
int startOffset = startPosition.Column - 1;
int endOffset = Math.Min(inlineBuilder.Text.Length, endPosition.Column - 1);
int endOffset = Math.Min(documentLine.Length, endPosition.Column - 1);
inlineBuilder.SetFontWeight(startOffset, endOffset - startOffset, FontWeights.Bold);
}
}
return inlineBuilder;
return new RichText(document.GetText(documentLine), inlineBuilder);
}
return null;
}

12
src/Main/Base/Project/ICSharpCode.SharpDevelop.addin

@ -165,11 +165,12 @@ @@ -165,11 +165,12 @@
class = "ICSharpCode.SharpDevelop.Gui.TaskListPad"
defaultPosition = "Bottom" />
<Pad id = "CompilerMessageView"
<Pad id = "OutputPad"
category = "Main"
title = "${res:MainWindow.Windows.OutputWindow}"
icon = "PadIcons.Output"
class = "ICSharpCode.SharpDevelop.Gui.CompilerMessageView"
serviceInterface = "ICSharpCode.SharpDevelop.Workbench.IOutputPad"
defaultPosition = "Bottom" />
<Pad id = "PropertyPad"
@ -989,6 +990,15 @@ @@ -989,6 +990,15 @@
</Path>
<Path name = "/SharpDevelop/Pads/ClassBrowser/AssemblyContextMenu">
<Condition name="IsProcessRunning" isdebugging = "False" action = "Exclude">
<Condition name="DebuggerSupports" debuggersupports = "Start">
<MenuItem id = "RunAssemblyWithDebugger"
label = "${res:XML.MainMenu.RunMenu.Run}"
icon = "Icons.16x16.RunProgramIcon"
class = "ICSharpCode.SharpDevelop.Dom.ClassBrowser.RunAssemblyWithDebuggerCommand"/>
<MenuItem id = "AssemblyContextMenuSeparator" type = "Separator"/>
</Condition>
</Condition>
<MenuItem id = "RemoveAssembly"
label = "Remove"
icon = "Icons.16x16.DeleteIcon"

4
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -84,6 +84,7 @@ @@ -84,6 +84,7 @@
</Compile>
<Compile Include="Designer\IDesignerTypeResolutionService.cs" />
<Compile Include="Designer\TypeResolutionService.cs" />
<Compile Include="Dom\ClassBrowser\AssemblyLoadErrorTreeNode.cs" />
<Compile Include="Dom\ClassBrowser\AssemblyTreeNode.cs" />
<Compile Include="Dom\ClassBrowser\ClassBrowserTreeView.cs" />
<Compile Include="Dom\ClassBrowser\IClassBrowser.cs" />
@ -110,9 +111,11 @@ @@ -110,9 +111,11 @@
<Compile Include="Dom\IModelCollection.cs" />
<Compile Include="Dom\ITreeNodeFactory.cs" />
<Compile Include="Dom\KeyedModelCollection.cs" />
<Compile Include="Dom\ModelCollectionChangedEvent.cs" />
<Compile Include="Dom\ModelCollectionLinq.cs" />
<Compile Include="Dom\ImmutableModelCollection.cs" />
<Compile Include="Dom\ModelCollectionTreeNode.cs" />
<Compile Include="Dom\ModelFactoryExtensions.cs" />
<Compile Include="Dom\SimpleModelCollection.cs" />
<Compile Include="Dom\SynchronizedModelCollection.cs" />
<Compile Include="Editor\AvalonEditTextEditorAdapter.cs" />
@ -328,6 +331,7 @@ @@ -328,6 +331,7 @@
<Compile Include="Workbench\File\FileService.cs" />
<Compile Include="Workbench\File\IRecentOpen.cs" />
<Compile Include="Workbench\ICustomizedCommands.cs" />
<Compile Include="Workbench\IOutputPad.cs" />
<Compile Include="Workbench\IPadContent.cs" />
<Compile Include="Workbench\IShutdownService.cs" />
<Compile Include="Workbench\IViewContent.cs" />

9
src/Main/Base/Project/Project/Build/BuildError.cs

@ -3,6 +3,9 @@ @@ -3,6 +3,9 @@
using System;
using System.Globalization;
using System.IO;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Utils;
using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Project
@ -164,5 +167,11 @@ namespace ICSharpCode.SharpDevelop.Project @@ -164,5 +167,11 @@ namespace ICSharpCode.SharpDevelop.Project
this.ErrorCode, this.ErrorText);
}
}
public RichText ToRichText()
{
// TODO: add some color
return new RichText(ToString());
}
}
}

4
src/Main/Base/Project/Project/Build/IBuildFeedbackSink.cs

@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Utils;
namespace ICSharpCode.SharpDevelop.Project
{
@ -25,6 +27,6 @@ namespace ICSharpCode.SharpDevelop.Project @@ -25,6 +27,6 @@ namespace ICSharpCode.SharpDevelop.Project
/// Reports a build message.
/// This member is thread-safe.
/// </summary>
void ReportMessage(string message);
void ReportMessage(RichText message);
}
}

5
src/Main/Base/Project/Services/SD.cs

@ -254,5 +254,10 @@ namespace ICSharpCode.SharpDevelop @@ -254,5 +254,10 @@ namespace ICSharpCode.SharpDevelop
public static IFileSystem FileSystem {
get { return GetRequiredService<IFileSystem>(); }
}
/// <inheritdoc see="IOutputPad"/>
public static IOutputPad OutputPad {
get { return GetRequiredService<IOutputPad>(); }
}
}
}

35
src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/CompilerMessageView.cs

@ -29,8 +29,41 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -29,8 +29,41 @@ namespace ICSharpCode.SharpDevelop.Gui
/// This class displays the errors and warnings which the compiler outputs and
/// allows the user to jump to the source of the warning / error
/// </summary>
public class CompilerMessageView : AbstractPadContent, IClipboardHandler
public class CompilerMessageView : AbstractPadContent, IClipboardHandler, IOutputPad
{
#region IOutputPad implementation
IOutputCategory IOutputPad.CreateCategory(string displayName)
{
var cat = new MessageViewCategory(displayName, displayName);
AddCategory(cat);
return cat;
}
void IOutputPad.RemoveCategory(IOutputCategory category)
{
throw new NotImplementedException();
}
IOutputCategory IOutputPad.CurrentCategory {
get {
return this.SelectedMessageViewCategory;
}
set {
int index = messageCategories.IndexOf(value as MessageViewCategory);
if (index >= 0)
SelectedCategoryIndex = index;
}
}
IOutputCategory IOutputPad.BuildCategory {
get {
return TaskService.BuildMessageViewCategory;
}
}
#endregion
static CompilerMessageView instance;
/// <summary>

34
src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/MessageViewCategory.cs

@ -3,6 +3,8 @@ @@ -3,6 +3,8 @@
using System;
using System.Text;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.SharpDevelop.Workbench;
namespace ICSharpCode.SharpDevelop.Gui
{
@ -10,8 +12,38 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -10,8 +12,38 @@ namespace ICSharpCode.SharpDevelop.Gui
/// This class represents a category with its text content used in the
/// output pad (CompilerMessageView).
/// </summary>
public class MessageViewCategory
public class MessageViewCategory : IOutputCategory
{
#region IOutputCategory implementation
void IOutputCategory.Activate(bool bringPadToFront)
{
SD.OutputPad.CurrentCategory = this;
if (bringPadToFront)
SD.OutputPad.BringToFront();
}
void IOutputCategory.Clear()
{
ClearText();
}
void IOutputCategory.AppendText(RichText text)
{
AppendText(text.ToString());
}
void IOutputCategory.AppendLine(RichText text)
{
AppendLine(text.ToString());
}
string IOutputCategory.DisplayName {
get { return displayCategory; }
}
#endregion
#region Static methods to create MessageViewCategories
/// <summary>
/// Creates a new MessageViewCategory with the specified category

5
src/Main/Base/Project/Src/Gui/Pads/CompilerMessageView/MessageViewCategoryTextWriter.cs

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
using System;
using System.IO;
using System.Text;
using ICSharpCode.SharpDevelop.Workbench;
namespace ICSharpCode.SharpDevelop.Gui
{
@ -12,9 +13,9 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -12,9 +13,9 @@ namespace ICSharpCode.SharpDevelop.Gui
/// </summary>
public class MessageViewCategoryTextWriter : TextWriter
{
readonly MessageViewCategory target;
readonly IOutputCategory target;
public MessageViewCategoryTextWriter(MessageViewCategory target)
public MessageViewCategoryTextWriter(IOutputCategory target)
{
this.target = target;
}

2
src/Main/Base/Project/Src/Project/AbstractProject.cs

@ -196,7 +196,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -196,7 +196,7 @@ namespace ICSharpCode.SharpDevelop.Project
#endregion
#region ProjectSections
SimpleModelCollection<SolutionSection> projectSections = new SimpleModelCollection<SolutionSection>();
SimpleModelCollection<SolutionSection> projectSections = new NullSafeSimpleModelCollection<SolutionSection>();
[Browsable(false)]
public IMutableModelCollection<SolutionSection> ProjectSections {

5
src/Main/Base/Project/Util/ProcessRunner.cs

@ -19,6 +19,7 @@ using ICSharpCode.Core; @@ -19,6 +19,7 @@ using ICSharpCode.Core;
using Microsoft.Win32.SafeHandles;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Util;
using ICSharpCode.SharpDevelop.Workbench;
namespace ICSharpCode.SharpDevelop
{
@ -38,7 +39,7 @@ namespace ICSharpCode.SharpDevelop @@ -38,7 +39,7 @@ namespace ICSharpCode.SharpDevelop
public interface IProcessRunner : IDisposable
{
Task<int> RunInOutputPadAsync(MessageViewCategory outputCategory, string program, params string[] arguments);
Task<int> RunInOutputPadAsync(IOutputCategory outputCategory, string program, params string[] arguments);
string WorkingDirectory { get; set; }
ProcessCreationFlags CreationFlags { get; set; }
IDictionary<string, string> EnvironmentVariables { get; }
@ -245,7 +246,7 @@ namespace ICSharpCode.SharpDevelop @@ -245,7 +246,7 @@ namespace ICSharpCode.SharpDevelop
#endregion
#region RunInOutputPad
public async Task<int> RunInOutputPadAsync(MessageViewCategory outputCategory, string program, params string[] arguments)
public async Task<int> RunInOutputPadAsync(IOutputCategory outputCategory, string program, params string[] arguments)
{
RedirectStandardOutputAndErrorToSingleStream = true;
Start(program, arguments);

5
src/Main/Base/Project/Workbench/File/FileService.cs

@ -233,10 +233,5 @@ namespace ICSharpCode.SharpDevelop @@ -233,10 +233,5 @@ namespace ICSharpCode.SharpDevelop
}
#endregion Events
public static object CreateUntitledOpenedFile(string plainFileName, byte[] byte1)
{
throw new NotImplementedException();
}
}
}

69
src/Main/Base/Project/Workbench/IOutputPad.cs

@ -0,0 +1,69 @@ @@ -0,0 +1,69 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.AvalonEdit.Highlighting;
namespace ICSharpCode.SharpDevelop.Workbench
{
/// <summary>
/// The 'Output' pad.
/// Allows showing a text log to the user.
/// </summary>
public interface IOutputPad
{
/// <summary>
/// Opens the pad.
/// </summary>
void BringToFront();
/// <summary>
/// Creates a new output category.
/// </summary>
IOutputCategory CreateCategory(string displayName);
/// <summary>
/// Removes an existing output category.
/// </summary>
void RemoveCategory(IOutputCategory category);
/// <summary>
/// Gets/Sets the current category.
/// This property is thread-safe.
/// </summary>
IOutputCategory CurrentCategory { get; set; }
/// <summary>
/// The "Build" category.
/// </summary>
IOutputCategory BuildCategory { get; }
}
public interface IOutputCategory
{
/// <summary>
/// Gets the display name of this category.
/// </summary>
string DisplayName { get; }
/// <summary>
/// Activates this output category in the UI.
/// </summary>
void Activate(bool bringPadToFront = false);
/// <summary>
/// Clears all text in the category.
/// </summary>
void Clear();
/// <summary>
/// Appends text to this category.
/// </summary>
void AppendText(RichText text);
/// <summary>
/// Appends text to this category, followed by a newline.
/// </summary>
void AppendLine(RichText text);
}
}

41
src/Main/SharpDevelop/Dom/ClassBrowser/ClassBrowserPad.cs

@ -216,45 +216,28 @@ namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser @@ -216,45 +216,28 @@ namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser
SD.PropertyService.SetList<PersistedWorkspace>(PersistedWorkspaceSetting, persistedWorkspaces);
}
public static IAssemblyModel CreateAssemblyModelFromFile(string fileName)
static IAssemblyModel SafelyCreateAssemblyModelFromFile(string fileName)
{
var modelFactory = SD.GetRequiredService<IModelFactory>();
try {
var loader = new CecilLoader();
loader.IncludeInternalMembers = true;
loader.LazyLoad = true;
var assembly = loader.LoadAssemblyFile(fileName);
IEntityModelContext context = new AssemblyEntityModelContext(assembly);
IAssemblyModel model = SD.GetRequiredService<IModelFactory>().CreateAssemblyModel(context);
if (model is IUpdateableAssemblyModel) {
((IUpdateableAssemblyModel)model).Update(EmptyList<IUnresolvedTypeDefinition>.Instance, assembly.TopLevelTypeDefinitions.ToList());
((IUpdateableAssemblyModel) model).AssemblyName = assembly.AssemblyName;
return modelFactory.CreateAssemblyModelFromFile(fileName);
} catch (Exception) {
// Special AssemblyModel for unresolved file references
IEntityModelContext unresolvedContext = new UnresolvedAssemblyEntityModelContext(Path.GetFileName(fileName), fileName);
IAssemblyModel unresolvedModel = modelFactory.CreateAssemblyModel(unresolvedContext);
if (unresolvedModel is IUpdateableAssemblyModel) {
((IUpdateableAssemblyModel) unresolvedModel).AssemblyName = unresolvedContext.AssemblyName;
}
return model;
} catch (BadImageFormatException ex) {
SD.MessageService.ShowWarningFormatted("{0} is not a valid .NET assembly.", Path.GetFileName(fileName));
} catch (FileNotFoundException ex) {
SD.MessageService.ShowWarningFormatted("{0} is not accessible or doesn't exist anymore.", fileName);
}
// AssemblyModel for unresolved file references
IEntityModelContext unresolvedContext = new UnresolvedAssemblyEntityModelContext(Path.GetFileName(fileName), fileName);
IAssemblyModel unresolvedModel = SD.GetRequiredService<IModelFactory>().CreateAssemblyModel(unresolvedContext);
if (unresolvedModel is IUpdateableAssemblyModel) {
((IUpdateableAssemblyModel) unresolvedModel).AssemblyName = unresolvedContext.AssemblyName;
return unresolvedModel;
}
return unresolvedModel;
}
void AppendAssemblyFileToList(string assemblyFile)
{
IAssemblyModel assemblyModel = CreateAssemblyModelFromFile(assemblyFile);
IAssemblyModel assemblyModel = SafelyCreateAssemblyModelFromFile(assemblyFile);
if (assemblyModel != null) {
AssemblyList.Assemblies.Add(assemblyModel);
} else {
// TODO Throw exception?
}
}

43
src/Main/SharpDevelop/Dom/ClassBrowser/Commands.cs

@ -2,47 +2,55 @@ @@ -2,47 +2,55 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using ICSharpCode.SharpDevelop.Debugging;
using Microsoft.Win32;
namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser
{
/// <summary>
/// Description of OpenAssemblyFromFileCommand.
/// OpenAssemblyFromFileCommand.
/// </summary>
class OpenAssemblyFromFileCommand : SimpleCommand
{
public override void Execute(object parameter)
{
var classBrowser = SD.GetService<IClassBrowser>();
if (classBrowser != null) {
var modelFactory = SD.GetService<IModelFactory>();
if ((classBrowser != null) && (modelFactory != null)) {
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "Assembly files (*.exe, *.dll)|*.exe;*.dll";
openFileDialog.CheckFileExists = true;
openFileDialog.CheckPathExists = true;
if (openFileDialog.ShowDialog() ?? false)
{
classBrowser.AssemblyList.Assemblies.Add(ClassBrowserPad.CreateAssemblyModelFromFile(openFileDialog.FileName));
IAssemblyModel assemblyModel = modelFactory.SafelyCreateAssemblyModelFromFile(openFileDialog.FileName);
if (assemblyModel != null)
classBrowser.AssemblyList.Assemblies.Add(assemblyModel);
}
}
}
}
/// <summary>
/// Description of OpenAssemblyFromGACCommand.
/// OpenAssemblyFromGACCommand.
/// </summary>
class OpenAssemblyFromGACCommand : SimpleCommand
{
public override void Execute(object parameter)
{
var classBrowser = SD.GetService<IClassBrowser>();
if (classBrowser != null) {
var modelFactory = SD.GetService<IModelFactory>();
if ((classBrowser != null) && (modelFactory != null)) {
OpenFromGacDialog gacDialog = new OpenFromGacDialog();
if (gacDialog.ShowDialog() ?? false)
{
foreach (string assemblyFile in gacDialog.SelectedFileNames) {
classBrowser.AssemblyList.Assemblies.Add(ClassBrowserPad.CreateAssemblyModelFromFile(assemblyFile));
IAssemblyModel assemblyModel = modelFactory.SafelyCreateAssemblyModelFromFile(assemblyFile);
if (assemblyModel != null)
classBrowser.AssemblyList.Assemblies.Add(assemblyModel);
}
}
}
@ -50,7 +58,7 @@ namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser @@ -50,7 +58,7 @@ namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser
}
/// <summary>
/// Description of RemoveAssemblyCommand.
/// RemoveAssemblyCommand.
/// </summary>
class RemoveAssemblyCommand : SimpleCommand
{
@ -70,16 +78,25 @@ namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser @@ -70,16 +78,25 @@ namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser
}
/// <summary>
/// Description of RemoveAssemblyCommand.
/// RunAssemblyWithDebuggerCommand.
/// </summary>
class ClassBrowserCollapseAllCommand : SimpleCommand
class RunAssemblyWithDebuggerCommand : SimpleCommand
{
public override bool CanExecute(object parameter)
{
IAssemblyModel assemblyModel = parameter as IAssemblyModel;
return (assemblyModel != null) && assemblyModel.Context.IsValid;
}
public override void Execute(object parameter)
{
// var classBrowser = SD.GetService<IClassBrowser>() as ClassBrowserPad;
// if (classBrowser != null) {
// classBrowser.TreeView
// }
IAssemblyModel assemblyModel = (IAssemblyModel) parameter;
// Start debugger with given assembly
DebuggerService.CurrentDebugger.Start(new ProcessStartInfo {
FileName = assemblyModel.Context.Location,
WorkingDirectory = Path.GetDirectoryName(assemblyModel.Context.Location)
});
}
}
}

3
src/Main/SharpDevelop/Dom/ClassBrowser/OpenFromGacDialog.xaml

@ -1,10 +1,11 @@ @@ -1,10 +1,11 @@
<Window
x:Class="ICSharpCode.SharpDevelop.Dom.ClassBrowser.OpenFromGacDialog"
x:ClassModifier="internal"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core="http://icsharpcode.net/sharpdevelop/core"
Title="Open From GAC"
Style="{DynamicResource DialogWindow}"
Style = "{x:Static core:GlobalStyles.DialogWindowStyle}"
WindowStartupLocation="CenterOwner"
ResizeMode="CanResizeWithGrip"
MinWidth="200"

2
src/Main/SharpDevelop/Dom/ClassBrowser/OpenFromGacDialog.xaml.cs

@ -35,7 +35,7 @@ namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser @@ -35,7 +35,7 @@ namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser
/// <summary>
/// Interaction logic for OpenFromGacDialog.xaml
/// </summary>
public partial class OpenFromGacDialog : Window
internal partial class OpenFromGacDialog : Window
{
ObservableCollection<GacEntry> gacEntries = new ObservableCollection<GacEntry>();
ObservableCollection<GacEntry> filteredEntries = new ObservableCollection<GacEntry>();

19
src/Main/SharpDevelop/Project/Build/BuildEngine.cs

@ -9,6 +9,7 @@ using System.Linq; @@ -9,6 +9,7 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
@ -56,7 +57,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -56,7 +57,7 @@ namespace ICSharpCode.SharpDevelop.Project
engine.results.Add(error);
if (engine.combinedBuildFeedbackSink != null) {
engine.combinedBuildFeedbackSink.ReportError(error);
engine.combinedBuildFeedbackSink.ReportMessage(error.ToString());
engine.combinedBuildFeedbackSink.ReportMessage(error.ToRichText());
}
engine.results.Result = BuildResultCode.BuildFileError;
@ -133,7 +134,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -133,7 +134,7 @@ namespace ICSharpCode.SharpDevelop.Project
/// <summary>The list of messages that were not reported because another node held the
/// output lock</summary>
internal List<string> unreportedMessageList;
internal List<RichText> unreportedMessageList;
public BuildNode(BuildEngine engine, IBuildable project)
{
@ -166,7 +167,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -166,7 +167,7 @@ namespace ICSharpCode.SharpDevelop.Project
engine.ReportError(this, error);
}
public void ReportMessage(string message)
public void ReportMessage(RichText message)
{
engine.ReportMessage(this, message);
}
@ -441,13 +442,13 @@ namespace ICSharpCode.SharpDevelop.Project @@ -441,13 +442,13 @@ namespace ICSharpCode.SharpDevelop.Project
if (!error.IsWarning)
source.hasErrors = true;
results.Add(error);
ReportMessage(source, error.ToString());
ReportMessage(source, error.ToRichText());
if (combinedBuildFeedbackSink != null) {
combinedBuildFeedbackSink.ReportError(error);
}
}
void ReportMessage(BuildNode source, string message)
void ReportMessage(BuildNode source, RichText message)
{
bool hasOutputLock;
lock (this) {
@ -458,7 +459,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -458,7 +459,7 @@ namespace ICSharpCode.SharpDevelop.Project
if (!hasOutputLock) {
if (source.unreportedMessageList == null) {
nodesWaitingForOutputLock.Enqueue(source);
source.unreportedMessageList = new List<string>();
source.unreportedMessageList = new List<RichText>();
}
source.unreportedMessageList.Add(message);
}
@ -470,7 +471,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -470,7 +471,7 @@ namespace ICSharpCode.SharpDevelop.Project
void LogBuildFinished(BuildNode node)
{
List<string> messagesToReport = null;
List<RichText> messagesToReport = null;
bool newNodeWithOutputLockAlreadyFinishedBuilding = false;
lock (this) {
if (node == nodeWithOutputLock) {
@ -499,10 +500,10 @@ namespace ICSharpCode.SharpDevelop.Project @@ -499,10 +500,10 @@ namespace ICSharpCode.SharpDevelop.Project
void ReportMessageLine(string message)
{
ReportMessageInternal(StringParser.Parse(message));
ReportMessageInternal(new RichText(StringParser.Parse(message)));
}
void ReportMessageInternal(string message)
void ReportMessageInternal(RichText message)
{
if (combinedBuildFeedbackSink != null)
combinedBuildFeedbackSink.ReportMessage(message);

2
src/Main/SharpDevelop/Project/Build/BuildService.cs

@ -68,7 +68,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -68,7 +68,7 @@ namespace ICSharpCode.SharpDevelop.Project
buildable = buildModifiedProjectsOnly.WrapBuildable(buildable, options.BuildDetection);
var sink = new UIBuildFeedbackSink(TaskService.BuildMessageViewCategory, SD.StatusBar);
var sink = new UIBuildFeedbackSink(SD.OutputPad.BuildCategory, SD.StatusBar);
// Actually run the build:
var results = await BuildEngine.BuildAsync(buildable, options, sink, progressMonitor);

9
src/Main/SharpDevelop/Project/Build/UIBuildFeedbackSink.cs

@ -8,8 +8,11 @@ using System.Linq; @@ -8,8 +8,11 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.AvalonEdit.Utils;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Workbench;
namespace ICSharpCode.SharpDevelop.Project
{
@ -18,10 +21,10 @@ namespace ICSharpCode.SharpDevelop.Project @@ -18,10 +21,10 @@ namespace ICSharpCode.SharpDevelop.Project
/// </summary>
sealed class UIBuildFeedbackSink : IBuildFeedbackSink
{
MessageViewCategory messageView;
IOutputCategory messageView;
IStatusBarService statusBarService;
public UIBuildFeedbackSink(MessageViewCategory messageView, IStatusBarService statusBarService)
public UIBuildFeedbackSink(IOutputCategory messageView, IStatusBarService statusBarService)
{
Debug.Assert(messageView != null);
Debug.Assert(statusBarService != null);
@ -37,7 +40,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -37,7 +40,7 @@ namespace ICSharpCode.SharpDevelop.Project
});
}
public void ReportMessage(string message)
public void ReportMessage(RichText message)
{
messageView.AppendLine(message);
}

2
src/Main/SharpDevelop/Project/ProjectService.cs

@ -17,7 +17,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -17,7 +17,7 @@ namespace ICSharpCode.SharpDevelop.Project
{
public SDProjectService()
{
allSolutions = new SimpleModelCollection<ISolution>();
allSolutions = new NullSafeSimpleModelCollection<ISolution>();
allProjects = allSolutions.SelectMany(s => s.Projects);
SD.GetFutureService<IWorkbench>().ContinueWith(t => t.Result.ActiveViewContentChanged += ActiveViewContentChanged);

2
src/Main/SharpDevelop/Workbench/FileService.cs

@ -454,7 +454,7 @@ namespace ICSharpCode.SharpDevelop.Workbench @@ -454,7 +454,7 @@ namespace ICSharpCode.SharpDevelop.Workbench
try {
IViewContent content = OpenFile(fileName);
IPositionable positionable = content.GetService<IPositionable>();
IPositionable positionable = content != null ? content.GetService<IPositionable>() : null;
if (positionable != null) {
content.WorkbenchWindow.ActiveViewContent = content;
NavigationService.ResumeLogging();

Loading…
Cancel
Save