Browse Source

Merge 3.0 into trunk.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3623 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 18 years ago
parent
commit
48af706f24
  1. 61
      data/options/WpfToolbox.xaml
  2. BIN
      data/resources/StringResources.de.resources
  3. BIN
      data/resources/StringResources.es-mx.resources
  4. BIN
      data/resources/StringResources.es.resources
  5. BIN
      data/resources/StringResources.nl.resources
  6. 8
      data/templates/file/CSharp/CSharp.Struct.xft
  7. 21
      samples/CppBackendBinding/CppProject.cs
  8. 0
      samples/ICSharpCode.Core.Demo/RequiredLibraries/ICSharpCode.SharpZipLib.dll
  9. 0
      samples/NAnt/NAnt.AddIn/Icons/build.bat
  10. 4
      samples/XamlDesigner/App.xaml
  11. 2
      samples/XamlDesigner/App.xaml.cs
  12. 26
      samples/XamlDesigner/Converters.cs
  13. 198
      samples/XamlDesigner/Document.cs
  14. 30
      samples/XamlDesigner/DocumentView.xaml
  15. 102
      samples/XamlDesigner/DocumentView.xaml.cs
  16. 10
      samples/XamlDesigner/ErrorListView.xaml
  17. 3
      samples/XamlDesigner/ErrorListView.xaml.cs
  18. BIN
      samples/XamlDesigner/Images/Control.png
  19. BIN
      samples/XamlDesigner/Images/Folder.png
  20. 184
      samples/XamlDesigner/MainWindow.xaml
  21. 26
      samples/XamlDesigner/MainWindow.xaml.cs
  22. 125
      samples/XamlDesigner/MainWindow_Commands.cs
  23. 3
      samples/XamlDesigner/Properties/AssemblyInfo.cs
  24. 110
      samples/XamlDesigner/Properties/Settings.Designer.cs
  25. 46
      samples/XamlDesigner/Properties/Settings.settings
  26. 29
      samples/XamlDesigner/Properties/app.manifest
  27. 85
      samples/XamlDesigner/Shell.cs
  28. 2
      samples/XamlDesigner/SimpleCommand.cs
  29. 10
      samples/XamlDesigner/TestFiles/grid.xaml
  30. 5
      samples/XamlDesigner/Toolbox.cs
  31. 26
      samples/XamlDesigner/ToolboxTreeView.cs
  32. 53
      samples/XamlDesigner/XamlDesigner.csproj
  33. 51
      samples/XamlDesigner/app.config
  34. 38
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpCompletionBinding.cs
  35. 0
      src/AddIns/BackendBindings/FSharp/RequiredLibraries/FSharp.Build.Tasks.dll
  36. 11
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsole.cs
  37. 45
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Console/PythonConsoleHomeKeyTestFixture.cs
  38. 1
      src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj
  39. 2
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockProjectContent.cs
  40. 7
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockTextEditorViewContent.cs
  41. 5
      src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixPackageFilesControl.cs
  42. 6
      src/AddIns/BackendBindings/WixBinding/Project/Src/IWixPackageFilesView.cs
  43. 2
      src/AddIns/BackendBindings/WixBinding/Project/Src/WixPackageFilesEditor.cs
  44. 60
      src/AddIns/BackendBindings/WixBinding/Test/PackageFiles/NoRootDirectoryFoundTestFixture.cs
  45. 4
      src/AddIns/BackendBindings/WixBinding/Test/PackageFiles/NoWixProductFileTestFixture.cs
  46. 7
      src/AddIns/BackendBindings/WixBinding/Test/Utils/MockTextEditorViewContent.cs
  47. 12
      src/AddIns/BackendBindings/WixBinding/Test/Utils/MockWixPackageFilesView.cs
  48. 1
      src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj
  49. 20
      src/AddIns/BackendBindings/XamlBinding/Project/Configuration/AssemblyInfo.cs
  50. 42
      src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlClassReturnType.cs
  51. 99
      src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlCodeCompletionBinding.cs
  52. 126
      src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlCompilationUnit.cs
  53. 63
      src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlExpressionContext.cs
  54. 74
      src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlExpressionFinder.cs
  55. 142
      src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlParser.cs
  56. 336
      src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlResolver.cs
  57. 43
      src/AddIns/BackendBindings/XamlBinding/Project/XamlBinding.addin
  58. 94
      src/AddIns/BackendBindings/XamlBinding/Project/XamlBinding.csproj
  59. 16
      src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/Properties/AssemblyInfo.cs
  60. 75
      src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XamlBinding.Tests.csproj
  61. 48
      src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XamlExpressionFinderTests.cs
  62. 15
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/ClassDiagramAddin.addin
  63. 5
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/ClassDiagramAddin.csproj
  64. 14
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ClassDiagramViewContent.cs
  65. 182
      src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ClassEditorPad.cs
  66. 22
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/AssemblyInfo.cs
  67. 177
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ClassEditor.Designer.cs
  68. 577
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ClassEditor.cs
  69. 87
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ClassEditor.csproj
  70. 120
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ClassEditor.resx
  71. 52
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/MemberDataEditors.cs
  72. 73
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/MemberEventArgs.cs
  73. 79
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ParameterEventArgs.cs
  74. BIN
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/closebrace.bmp
  75. BIN
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/comma.bmp
  76. BIN
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/emptybraces.bmp
  77. BIN
      src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/openbrace.bmp
  78. 24
      src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/ClassWizard.addin
  79. 91
      src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/ClassWizard.csproj
  80. 20
      src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/Configuration/AssemblyInfo.cs
  81. 215
      src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/Resources/AddClassForm.xfrm
  82. 39
      src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/Resources/ClassesList.xfrm
  83. 189
      src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/Src/AddClassForm.cs
  84. 34
      src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/Src/AddNewClassCommand.cs
  85. 13
      src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/Src/AddNewInterfaceCommand.cs
  86. 185
      src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/Src/ClassesList.cs
  87. 8
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs
  88. 40
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs
  89. 18
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/CustomComponentsSideTab.cs
  90. 63
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeResolutionService.cs
  91. 16
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Configuration/AssemblyInfo.cs
  92. 112
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/AbstractEventHandlerService.cs
  93. 47
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/CSharpEventHandlerService.cs
  94. 39
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/FileUriContext.cs
  95. 49
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/IdeChooseClassService.cs
  96. 62
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/MyTypeFinder.cs
  97. 8
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ObjectEditor.xaml
  98. 31
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ObjectEditor.xaml.cs
  99. 47
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/OutlineViewPad.cs
  100. 41
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/PropertyDescriptionService.cs
  101. Some files were not shown because too many files have changed in this diff Show More

61
data/options/WpfToolbox.xaml

@ -0,0 +1,61 @@ @@ -0,0 +1,61 @@
<Default:ToolboxData xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Default="clr-namespace:ICSharpCode.WpfDesign.Designer;assembly=ICSharpCode.WpfDesign.Designer"
xmlns:Forms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms">
<Default:ToolboxItem Type="Button"
FormsType="{x:Type Forms:Button}" />
<Default:ToolboxItem Type="CheckBox"
FormsType="{x:Type Forms:CheckBox}" />
<Default:ToolboxItem Type="ComboBox"
FormsType="{x:Type Forms:ComboBox}" />
<Default:ToolboxItem Type="Label"
FormsType="{x:Type Forms:Label}" />
<Default:ToolboxItem Type="TextBox"
FormsType="{x:Type Forms:TextBox}" />
<Default:ToolboxItem Type="RadioButton"
FormsType="{x:Type Forms:RadioButton}" />
<Default:ToolboxItem Type="Canvas"
FormsType="{x:Type Forms:Panel}" />
<Default:ToolboxItem Type="Grid"
FormsType="{x:Type Forms:TableLayoutPanel}" />
<Default:ToolboxItem Type="Border"
FormsType="{x:Type Forms:Panel}" />
<Default:ToolboxItem Type="DockPanel"
FormsType="{x:Type Forms:Panel}" />
<Default:ToolboxItem Type="Expander"
FormsType="{x:Type Forms:Panel}" />
<Default:ToolboxItem Type="GroupBox"
FormsType="{x:Type Forms:GroupBox}" />
<Default:ToolboxItem Type="Image"
FormsType="{x:Type Forms:PictureBox}" />
<Default:ToolboxItem Type="InkCanvas"
FormsType="{x:Type Forms:Panel}" />
<Default:ToolboxItem Type="ListBox"
FormsType="{x:Type Forms:ListBox}" />
<Default:ToolboxItem Type="Menu"
FormsType="{x:Type Forms:MenuStrip}" />
<Default:ToolboxItem Type="PasswordBox"
FormsType="{x:Type Forms:TextBox}" />
<Default:ToolboxItem Type="ProgressBar"
FormsType="{x:Type Forms:ProgressBar}" />
<Default:ToolboxItem Type="RichTextBox"
FormsType="{x:Type Forms:RichTextBox}" />
<Default:ToolboxItem Type="ScrollViewer"
FormsType="{x:Type Forms:VScrollBar}" />
<Default:ToolboxItem Type="Slider"
FormsType="{x:Type Forms:TrackBar}" />
<Default:ToolboxItem Type="StackPanel"
FormsType="{x:Type Forms:Panel}" />
<Default:ToolboxItem Type="TabControl"
FormsType="{x:Type Forms:TabControl}" />
<Default:ToolboxItem Type="ToolBar"
FormsType="{x:Type Forms:ToolStrip}" />
<Default:ToolboxItem Type="TreeView"
FormsType="{x:Type Forms:TreeView}" />
<Default:ToolboxItem Type="Viewbox"
FormsType="{x:Type Forms:Panel}" />
<Default:ToolboxItem Type="Viewport3D"
FormsType="{x:Type Forms:Panel}" />
<Default:ToolboxItem Type="WrapPanel"
FormsType="{x:Type Forms:FlowLayoutPanel}" />
</Default:ToolboxData>

BIN
data/resources/StringResources.de.resources

Binary file not shown.

BIN
data/resources/StringResources.es-mx.resources

Binary file not shown.

BIN
data/resources/StringResources.es.resources

Binary file not shown.

BIN
data/resources/StringResources.nl.resources

Binary file not shown.

8
data/templates/file/CSharp/CSharp.Struct.xft

@ -57,14 +57,14 @@ namespace ${StandardNamespace} @@ -57,14 +57,14 @@ namespace ${StandardNamespace}
return member.GetHashCode();
}
public static bool operator ==(${ClassName} lhs, ${ClassName} rhs)
public static bool operator ==(${ClassName} left, ${ClassName} right)
{
return lhs.Equals(rhs);
return left.Equals(right);
}
public static bool operator !=(${ClassName} lhs, ${ClassName} rhs)
public static bool operator !=(${ClassName} left, ${ClassName} right)
{
return !(lhs.Equals(rhs)); // use operator == and negate result
return !left.Equals(right);
}
#endregion
}

21
samples/CppBackendBinding/CppProject.cs

@ -215,10 +215,15 @@ namespace CppBackendBinding @@ -215,10 +215,15 @@ namespace CppBackendBinding
{
string productDir = GetPathFromRegistry(@"SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VC", "ProductDir");
string batFile = "vcvars32.bat";
if (options.Platform == "x64") {
batFile = "vcvars64.bat";
}
string commonTools =
GetFile(productDir != null ? Path.Combine(productDir, "bin\\vcvars32.bat") : null)
?? GetFile("%VS90COMNTOOLS%\\vsvars32.bat")
?? GetFile("%VS80COMNTOOLS%\\vsvars32.bat");
GetFile(productDir != null ? Path.Combine(productDir, "bin\\" + batFile) : null)
?? GetFile("%VS90COMNTOOLS%\\" + batFile)
?? GetFile("%VS80COMNTOOLS%\\" + batFile);
Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
@ -326,5 +331,15 @@ namespace CppBackendBinding @@ -326,5 +331,15 @@ namespace CppBackendBinding
return null;
}
}
public override ICollection<string> PlatformNames {
get {
List<string> l = new List<string>();
foreach (XmlElement platformElement in document.DocumentElement["Platforms"]) {
l.Add(platformElement.GetAttribute("Name"));
}
return l.AsReadOnly();
}
}
}
}

0
samples/ICSharpCode.Core.Demo/RequiredLibraries/ICSharpCode.SharpZipLib.dll

0
samples/NAnt/NAnt.AddIn/Icons/build.bat

4
samples/XamlDesigner/App.xaml

@ -5,9 +5,9 @@ @@ -5,9 +5,9 @@
StartupUri="MainWindow.xaml"
ShutdownMode="OnMainWindowClose">
<Application.Resources>
<Converters:CollapsedWhenFalse x:Key="CollapsedWhenFalse" />
<Converters:FalseWhenZero x:Key="FalseWhenZero" />
</Application.Resources>
</Application>

2
samples/XamlDesigner/App.xaml.cs

@ -4,7 +4,7 @@ using System.Configuration; @@ -4,7 +4,7 @@ using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using ICSharpCode.XamlDesigner.Configuration;
using ICSharpCode.XamlDesigner.Properties;
using System.Windows.Threading;
using System.Diagnostics;

26
samples/XamlDesigner/Converters.cs

@ -9,21 +9,21 @@ using System.Collections; @@ -9,21 +9,21 @@ using System.Collections;
namespace ICSharpCode.XamlDesigner.Converters
{
public class EnumToIntConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (int)value;
}
public class EnumToIntConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (int)value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
public class CollapsedWhenFalse : IValueConverter
{
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool)value ? Visibility.Visible : Visibility.Collapsed;
@ -36,7 +36,7 @@ namespace ICSharpCode.XamlDesigner.Converters @@ -36,7 +36,7 @@ namespace ICSharpCode.XamlDesigner.Converters
}
public class FalseWhenZero : IValueConverter
{
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null || (int)value == 0) {

198
samples/XamlDesigner/Document.cs

@ -5,7 +5,7 @@ using System.Text; @@ -5,7 +5,7 @@ using System.Text;
using System.ComponentModel;
using System.IO;
using ICSharpCode.WpfDesign.Designer;
using ICSharpCode.WpfDesign.Designer.Xaml;
using ICSharpCode.WpfDesign.Designer.XamlBackend;
using ICSharpCode.WpfDesign.Designer.OutlineView;
using System.Xml;
using ICSharpCode.WpfDesign;
@ -17,28 +17,41 @@ namespace ICSharpCode.XamlDesigner @@ -17,28 +17,41 @@ namespace ICSharpCode.XamlDesigner
public class Document : INotifyPropertyChanged
{
public Document(string tempName, string text)
: this()
{
this.tempName = tempName;
Text = text;
Context.Parse(Text);
IsDirty = false;
}
public Document(string filePath)
: this()
{
this.filePath = filePath;
ReloadFile();
}
Document()
{
var doc = Shell.Instance.Project.CreateDocument();
context = new XamlDesignContext(doc);
context.UndoService.UndoStackChanged += new EventHandler(UndoService_UndoStackChanged);
}
string tempName;
DesignSurface designSurface = new DesignSurface();
XamlDesignContext context;
string text;
public string Text {
get {
public string Text
{
get
{
return text;
}
set {
set
{
if (text != value) {
text = value;
IsDirty = true;
@ -49,39 +62,47 @@ namespace ICSharpCode.XamlDesigner @@ -49,39 +62,47 @@ namespace ICSharpCode.XamlDesigner
DocumentMode mode;
public DocumentMode Mode {
get {
public DocumentMode Mode
{
get
{
return mode;
}
set {
set
{
mode = value;
if (InDesignMode) {
UpdateDesign();
}
else {
UpdateXaml();
}
//if (InDesignMode) {
// UpdateDesign();
//}
//else {
// UpdateXaml();
//}
RaisePropertyChanged("Mode");
RaisePropertyChanged("InXamlMode");
RaisePropertyChanged("InDesignMode");
}
}
public bool InXamlMode {
public bool InXamlMode
{
get { return Mode == DocumentMode.Xaml; }
}
public bool InDesignMode {
public bool InDesignMode
{
get { return Mode == DocumentMode.Design; }
}
string filePath;
public string FilePath {
get {
public string FilePath
{
get
{
return filePath;
}
private set {
private set
{
filePath = value;
RaisePropertyChanged("FilePath");
RaisePropertyChanged("FileName");
@ -92,11 +113,14 @@ namespace ICSharpCode.XamlDesigner @@ -92,11 +113,14 @@ namespace ICSharpCode.XamlDesigner
bool isDirty;
public bool IsDirty {
get {
public bool IsDirty
{
get
{
return isDirty;
}
private set {
private set
{
isDirty = value;
RaisePropertyChanged("IsDirty");
RaisePropertyChanged("Name");
@ -104,79 +128,59 @@ namespace ICSharpCode.XamlDesigner @@ -104,79 +128,59 @@ namespace ICSharpCode.XamlDesigner
}
}
public string FileName {
get {
public string FileName
{
get
{
if (FilePath == null) return null;
return Path.GetFileName(FilePath);
}
}
public string Name {
get {
public string Name
{
get
{
return FileName ?? tempName;
}
}
public string Title {
get {
public string Title
{
get
{
return IsDirty ? Name + "*" : Name;
}
}
public DesignSurface DesignSurface {
get { return designSurface; }
}
public DesignContext DesignContext {
get { return designSurface.DesignContext; }
}
public UndoService UndoService {
get { return DesignContext.Services.GetService<UndoService>(); }
}
public ISelectionService SelectionService {
get {
if (InDesignMode) {
return DesignContext.Services.Selection;
}
return null;
}
}
public XamlErrorService XamlErrorService {
get {
if (DesignContext != null) {
return DesignContext.Services.GetService<XamlErrorService>();
}
return null;
}
public DesignContext Context
{
get { return context; }
}
OutlineNode outlineRoot;
public OutlineNode OutlineRoot {
get {
return outlineRoot;
}
private set {
outlineRoot = value;
RaisePropertyChanged("OutlineRoot");
}
}
//TODO
//public XamlErrorService XamlErrorService {
// get {
// if (DesignContext != null) {
// return DesignContext.GetService<XamlErrorService>();
// }
// return null;
// }
//}
void ReloadFile()
{
Text = File.ReadAllText(FilePath);
UpdateDesign();
//UpdateDesign();
Context.Parse(Text);
IsDirty = false;
}
public void Save()
{
if (InDesignMode) {
UpdateXaml();
}
//if (InDesignMode) {
// UpdateXaml();
//}
File.WriteAllText(FilePath, Text);
IsDirty = false;
}
@ -189,41 +193,33 @@ namespace ICSharpCode.XamlDesigner @@ -189,41 +193,33 @@ namespace ICSharpCode.XamlDesigner
public void Refresh()
{
UpdateXaml();
UpdateDesign();
//UpdateXaml();
//UpdateDesign();
}
void UpdateXaml()
{
if (DesignContext.CanSave && UndoService.CanUndo) {
var sb = new StringBuilder();
using (var xmlWriter = XmlWriter.Create(sb)) {
DesignSurface.SaveDesigner(xmlWriter);
Text = XamlFormatter.Format(sb.ToString());
}
}
}
//void UpdateXaml()
//{
// if (Context.CanSave) {
// Text = Context.Save();
// }
//}
void UpdateDesign()
{
OutlineRoot = null;
using (var xmlReader = XmlReader.Create(new StringReader(Text))) {
DesignSurface.LoadDesigner(xmlReader, null);
}
if (DesignContext.RootItem != null) {
OutlineRoot = OutlineNode.Create(DesignContext.RootItem);
UndoService.UndoStackChanged += new EventHandler(UndoService_UndoStackChanged);
}
RaisePropertyChanged("SelectionService");
RaisePropertyChanged("XamlErrorService");
}
//void UpdateDesign()
//{
// Context.Parse(Text);
//}
void UndoService_UndoStackChanged(object sender, EventArgs e)
{
IsDirty = true;
if (InXamlMode) {
UpdateXaml();
}
IsDirty = Context.UndoService.CanUndo;
if (Context.ParseSuggested) {
Context.Parse(Text);
}
//if (Context.Is
//IsDirty = true;
//if (InXamlMode) {
// UpdateXaml();
//}
}
#region INotifyPropertyChanged Members

30
samples/XamlDesigner/DocumentView.xaml

@ -1,23 +1,23 @@ @@ -1,23 +1,23 @@
<UserControl
x:Class="ICSharpCode.XamlDesigner.DocumentView"
xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Integration="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:TextEditor="clr-namespace:ICSharpCode.TextEditor;assembly=ICSharpCode.TextEditor"
xmlns:Default="clr-namespace:ICSharpCode.XamlDesigner"
xmlns:DesignerControls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls;assembly=ICSharpCode.WpfDesign.Designer"
>
<UserControl x:Class="ICSharpCode.XamlDesigner.DocumentView"
xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Integration="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:Default="clr-namespace:ICSharpCode.XamlDesigner"
xmlns:Designer="clr-namespace:ICSharpCode.WpfDesign.Designer;assembly=ICSharpCode.WpfDesign.Designer"
xmlns:DesignerControls="clr-namespace:ICSharpCode.WpfDesign.Designer.Controls;assembly=ICSharpCode.WpfDesign.Designer">
<DockPanel>
<DesignerControls:EnumBar Value="{Binding Mode}"
DockPanel.Dock="Bottom"/>
DockPanel.Dock="Bottom" />
<Grid>
<Integration:WindowsFormsHost Visibility="{Binding InXamlMode, Converter={StaticResource CollapsedWhenFalse}}">
<TextEditor:TextEditorControl x:Name="uxTextEditor" />
<Default:TextEditorWithoutUndo x:Name="uxTextEditor" />
</Integration:WindowsFormsHost>
<ContentPresenter Content="{Binding DesignSurface}"
Visibility="{Binding InDesignMode, Converter={StaticResource CollapsedWhenFalse}}"/>
<Designer:DesignSurface x:Name="uxDesignSurface"
Context="{Binding Context}"
Visibility="{Binding InDesignMode, Converter={StaticResource CollapsedWhenFalse}}" />
</Grid>
</DockPanel>
</UserControl>

102
samples/XamlDesigner/DocumentView.xaml.cs

@ -13,6 +13,13 @@ using System.Windows.Navigation; @@ -13,6 +13,13 @@ using System.Windows.Navigation;
using System.Windows.Shapes;
using ICSharpCode.WpfDesign.Designer.Services;
using System.Windows.Threading;
using ICSharpCode.Xaml;
using ICSharpCode.WpfDesign.Designer;
using ICSharpCode.TextEditor;
using System.Windows.Forms;
using ICSharpCode.TextEditor.Document;
using ICSharpCode.WpfDesign;
using ICSharpCode.TextEditor.Undo;
namespace ICSharpCode.XamlDesigner
{
@ -22,21 +29,106 @@ namespace ICSharpCode.XamlDesigner @@ -22,21 +29,106 @@ namespace ICSharpCode.XamlDesigner
{
InitializeComponent();
Document = doc;
ShellDocument = doc;
Shell.Instance.Views[doc] = this;
uxTextEditor.SetHighlighting("XML");
uxTextEditor.DataBindings.Add("Text", doc, "Text", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged);
ShellDocument.Context.AddService(typeof(ITextContainer), uxTextEditor);
uxTextEditor.Document.UndoStack.OperationPushed += UndoStack_OperationPushed;
uxTextEditor.Document.DocumentChanged += Document_DocumentChanged;
uxTextEditor.Document.DocumentAboutToBeChanged += Document_DocumentAboutToBeChanged;
}
public Document ShellDocument { get; private set; }
IUndoableOperation lastOperation;
bool textValid;
void Document_DocumentAboutToBeChanged(object sender, DocumentEventArgs e)
{
textValid = false;
}
void Document_DocumentChanged(object sender, DocumentEventArgs e)
{
textValid = true;
TryUpdateDesignUndoStack();
}
void UndoStack_OperationPushed(object sender, OperationEventArgs e)
{
lastOperation = e.Operation;
TryUpdateDesignUndoStack();
}
void TryUpdateDesignUndoStack()
{
if (textValid && lastOperation != null) {
ShellDocument.Context.UndoService.Done(new TextAction(lastOperation));
lastOperation = null;
}
}
public Document Document { get; private set; }
public DesignSurface DesignSurface
{
get
{
return uxDesignSurface;
}
}
public void JumpToError(XamlError error)
public void JumpToError(XamlDocumentError error)
{
Document.Mode = DocumentMode.Xaml;
ShellDocument.Mode = DocumentMode.Xaml;
Dispatcher.BeginInvoke(new Action(delegate {
uxTextEditor.ActiveTextAreaControl.JumpTo(error.Line - 1, error.Column - 1);
uxTextEditor.ActiveTextAreaControl.JumpTo(error.LineNumber - 1, error.LinePosition - 1);
}), DispatcherPriority.Background);
}
}
class TextEditorWithoutUndo : TextEditorControl, ITextContainer
{
public TextEditorWithoutUndo()
{
editactions.Remove(Keys.Control | Keys.Z);
editactions.Remove(Keys.Control | Keys.Y);
}
public override void EndUpdate()
{
base.EndUpdate();
}
}
class TextAction : ITextAction
{
public TextAction(IUndoableOperation op)
{
this.op = op;
}
IUndoableOperation op;
public IEnumerable<DesignItem> AffectedItems
{
get { yield break; }
}
public string Title
{
get { return "Text Editing"; }
}
public void Do()
{
op.Redo();
}
public void Undo()
{
op.Undo();
}
}
}

10
samples/XamlDesigner/ErrorListView.xaml

@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
<ListBox x:Class="ICSharpCode.XamlDesigner.ErrorListView"
xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Services="clr-namespace:ICSharpCode.WpfDesign.Designer.Services;assembly=ICSharpCode.WpfDesign.Designer">
xmlns:Xaml="clr-namespace:ICSharpCode.Xaml;assembly=ICSharpCode.Xaml">
<Control.Resources>
<DataTemplate DataType="{x:Type Services:XamlError}">
<DataTemplate DataType="{x:Type Xaml:XamlDocumentError}">
<StackPanel Orientation="Horizontal">
<Image Source="Images/Error.png"
Stretch="None"
Margin="2"/>
<TextBlock Text="{Binding Message}"
VerticalAlignment="Center"/>
Margin="2" />
<TextBlock Text="{Binding Message}"
VerticalAlignment="Center" />
</StackPanel>
</DataTemplate>
</Control.Resources>

3
samples/XamlDesigner/ErrorListView.xaml.cs

@ -12,6 +12,7 @@ using System.Windows.Media.Imaging; @@ -12,6 +12,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ICSharpCode.WpfDesign.Designer.Services;
using ICSharpCode.Xaml;
namespace ICSharpCode.XamlDesigner
{
@ -24,7 +25,7 @@ namespace ICSharpCode.XamlDesigner @@ -24,7 +25,7 @@ namespace ICSharpCode.XamlDesigner
protected override void OnMouseDoubleClick(MouseButtonEventArgs e)
{
var error = e.GetDataContext() as XamlError;
var error = e.GetDataContext() as XamlDocumentError;
if (error != null) {
Shell.Instance.JumpToError(error);
}

BIN
samples/XamlDesigner/Images/Control.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 470 B

BIN
samples/XamlDesigner/Images/Folder.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

184
samples/XamlDesigner/MainWindow.xaml

@ -5,114 +5,86 @@ @@ -5,114 +5,86 @@
xmlns:sd="http://sharpdevelop.net"
xmlns:AvalonDock="clr-namespace:AvalonDock;assembly=AvalonDock"
xmlns:Outline="clr-namespace:ICSharpCode.WpfDesign.Designer.OutlineView;assembly=ICSharpCode.WpfDesign.Designer"
xmlns:Designer="clr-namespace:ICSharpCode.WpfDesign.Designer;assembly=ICSharpCode.WpfDesign.Designer"
xmlns:Default="clr-namespace:ICSharpCode.XamlDesigner"
SnapsToDevicePixels="True"
AllowDrop="True"
Title="{Binding Title}">
<Window.CommandBindings>
<CommandBinding Command="New"
Executed="NewCommand_Executed" />
<CommandBinding Command="Open"
Executed="OpenCommand_Executed" />
<CommandBinding Command="Close"
Executed="CloseCommand_Executed"
CanExecute="CurrentDocument_CanExecute"
PreviewExecuted="CloseCommand_PreviewExecuted"/>
<CommandBinding Command="Default:MainWindow.CloseAllCommand"
Executed="CloseAllCommand_Executed"
CanExecute="CurrentDocument_CanExecute" />
<CommandBinding Command="Save"
Executed="SaveCommand_Executed"
CanExecute="CurrentDocument_CanExecute" />
<CommandBinding Command="SaveAs"
Executed="SaveAsCommand_Executed"
CanExecute="CurrentDocument_CanExecute" />
<CommandBinding Command="Default:MainWindow.SaveAllCommand"
Executed="SaveAllCommand_Executed"
CanExecute="CurrentDocument_CanExecute" />
<CommandBinding Command="Default:MainWindow.ExitCommand"
Executed="ExitCommand_Executed" />
</Window.CommandBindings>
<DockPanel>
<Menu DockPanel.Dock="Top">
<MenuItem Header="File">
<MenuItem Command="New" />
<MenuItem Command="Open" />
<Separator />
<MenuItem Command="Close" />
<MenuItem Command="Default:MainWindow.CloseAllCommand" />
<Separator />
<MenuItem Command="Save" />
<MenuItem Command="SaveAs" />
<MenuItem Command="Default:MainWindow.SaveAllCommand" />
<Separator />
<MenuItem Header="Recent Files"
ItemsSource="{Binding RecentFiles}"
IsEnabled="{Binding RecentFiles.Count, Converter={StaticResource FalseWhenZero}}"
Click="RecentFiles_Click"/>
<Separator />
<MenuItem Command="Default:MainWindow.ExitCommand" />
</MenuItem>
<MenuItem Header="Edit">
<MenuItem Command="Undo" />
<MenuItem Command="Redo" />
<Separator />
<MenuItem Command="Cut" />
<MenuItem Command="Copy" />
<MenuItem Command="Paste" />
<MenuItem Command="Delete" />
<MenuItem Command="SelectAll" />
<Separator />
<MenuItem Command="Default:MainWindow.RefreshCommand" />
<MenuItem Command="Find" />
</MenuItem>
</Menu>
<AvalonDock:DockingManager x:Name="uxDockingManager">
<AvalonDock:ResizingPanel>
<AvalonDock:DocumentPane x:Name="uxDocumentPane"
SelectedValue="{Binding CurrentDocument}"
SelectedValuePath="DataContext"/>
<AvalonDock:DockablePane>
<AvalonDock:DockableContent x:Name="content1" Title="Toolbox">
<Default:ToolboxView />
</AvalonDock:DockableContent>
</AvalonDock:DockablePane>
<AvalonDock:DockablePane>
<AvalonDock:DockableContent x:Name="content2" Title="Outline">
<Outline:Outline Root="{Binding CurrentDocument.OutlineRoot}"/>
</AvalonDock:DockableContent>
</AvalonDock:DockablePane>
<AvalonDock:DockablePane>
<AvalonDock:DockableContent x:Name="content3" Title="Errors">
<Default:ErrorListView ItemsSource="{Binding CurrentDocument.XamlErrorService.Errors}"/>
</AvalonDock:DockableContent>
</AvalonDock:DockablePane>
<AvalonDock:DockablePane>
<AvalonDock:DockableContent x:Name="content4" Title="Properties">
<sd:PropertyGridView x:Name="uxPropertyGridView"
SelectedItems="{Binding DataContext.CurrentDocument.SelectionService.SelectedItems, ElementName=root, FallbackValue={x:Null}}"/>
</AvalonDock:DockableContent>
</AvalonDock:DockablePane>
</AvalonDock:ResizingPanel>
</AvalonDock:DockingManager>
</DockPanel>
<DockPanel>
<Menu DockPanel.Dock="Top">
<MenuItem Header="File">
<MenuItem Command="New" />
<MenuItem Command="Open" />
<Separator />
<MenuItem Command="Close" />
<MenuItem Command="Default:MainWindow.CloseAllCommand" />
<Separator />
<MenuItem Command="Save" />
<MenuItem Command="SaveAs" />
<MenuItem Command="Default:MainWindow.SaveAllCommand" />
<Separator />
<MenuItem Header="Recent Files"
ItemsSource="{Binding RecentFiles}"
IsEnabled="{Binding RecentFiles.Count, Converter={StaticResource FalseWhenZero}}"
Click="RecentFiles_Click" />
<Separator />
<MenuItem Command="Default:MainWindow.ExitCommand" />
</MenuItem>
<MenuItem Header="Edit">
<MenuItem Command="Undo" />
<MenuItem Command="Redo" />
<Separator />
<MenuItem Command="Cut" />
<MenuItem Command="Copy" />
<MenuItem Command="Paste" />
<MenuItem Command="Delete" />
<MenuItem Command="SelectAll" />
<Separator />
<MenuItem Command="Default:MainWindow.RefreshCommand" />
<MenuItem Command="Find" />
</MenuItem>
</Menu>
<AvalonDock:DockingManager x:Name="uxDockingManager">
<AvalonDock:ResizingPanel>
<AvalonDock:DocumentPane x:Name="uxDocumentPane"
SelectedValue="{Binding CurrentDocument}"
SelectedValuePath="DataContext" />
<AvalonDock:DockablePane>
<AvalonDock:DockableContent x:Name="content1"
Title="Toolbox">
<Designer:Toolbox x:Name="uxToolbox"
Context="{Binding CurrentDocument.Context}" />
</AvalonDock:DockableContent>
</AvalonDock:DockablePane>
<AvalonDock:DockablePane>
<AvalonDock:DockableContent x:Name="content2"
Title="Outline">
<Outline:Outline Context="{Binding CurrentDocument.Context}" />
</AvalonDock:DockableContent>
</AvalonDock:DockablePane>
<AvalonDock:DockablePane>
<AvalonDock:DockableContent x:Name="content3"
Title="Errors">
<Default:ErrorListView ItemsSource="{Binding CurrentDocument.Context.Document.Errors}" />
</AvalonDock:DockableContent>
</AvalonDock:DockablePane>
<AvalonDock:DockablePane>
<AvalonDock:DockableContent x:Name="content4"
Title="Properties">
<sd:PropertyGridView x:Name="uxPropertyGridView"
Context="{Binding CurrentDocument.Context}" />
</AvalonDock:DockableContent>
</AvalonDock:DockablePane>
</AvalonDock:ResizingPanel>
</AvalonDock:DockingManager>
</DockPanel>
</Window>

26
samples/XamlDesigner/MainWindow.xaml.cs

@ -10,13 +10,14 @@ using System.Windows.Input; @@ -10,13 +10,14 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ICSharpCode.XamlDesigner.Configuration;
using ICSharpCode.XamlDesigner.Properties;
using System.ComponentModel;
using Microsoft.Win32;
using AvalonDock;
using System.IO;
using System.Collections.Specialized;
using ICSharpCode.WpfDesign.Designer;
using ICSharpCode.Xaml;
namespace ICSharpCode.XamlDesigner
{
@ -27,15 +28,12 @@ namespace ICSharpCode.XamlDesigner @@ -27,15 +28,12 @@ namespace ICSharpCode.XamlDesigner
Instance = this;
DataContext = Shell.Instance;
RenameCommands();
BasicMetadata.Register();
InitializeComponent();
Shell.Instance.PropertyGrid = uxPropertyGridView.PropertyGrid;
AvalonDockWorkaround();
RouteDesignSurfaceCommands();
this.AddCommandHandler(RefreshCommand, Shell.Instance.Refresh, Shell.Instance.CanRefresh);
RegisterCommandHandlers();
LoadSettings();
ProcessPaths(App.Args);
@ -89,7 +87,7 @@ namespace ICSharpCode.XamlDesigner @@ -89,7 +87,7 @@ namespace ICSharpCode.XamlDesigner
e.Effects = DragDropEffects.Copy;
break;
}
else if (path.EndsWith(".xaml", StringComparison.InvariantCultureIgnoreCase)) {
else if (XamlConstants.HasXamlExtension(path)) {
e.Effects = DragDropEffects.Copy;
break;
}
@ -99,11 +97,12 @@ namespace ICSharpCode.XamlDesigner @@ -99,11 +97,12 @@ namespace ICSharpCode.XamlDesigner
void ProcessPaths(IEnumerable<string> paths)
{
foreach (var path in paths) {
if (path.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase) ||
path.EndsWith(".exe", StringComparison.InvariantCultureIgnoreCase)) {
Toolbox.Instance.AddAssembly(path);
}
else if (path.EndsWith(".xaml", StringComparison.InvariantCultureIgnoreCase)) {
//if (path.EndsWith(".dll", StringComparison.InvariantCultureIgnoreCase) ||
// path.EndsWith(".exe", StringComparison.InvariantCultureIgnoreCase)) {
// Toolbox.Instance.AddAssembly(path);
//}
//else
if (XamlConstants.HasXamlExtension(path)) {
Shell.Instance.Open(path);
}
}
@ -149,6 +148,11 @@ namespace ICSharpCode.XamlDesigner @@ -149,6 +148,11 @@ namespace ICSharpCode.XamlDesigner
if (Settings.Default.AvalonDockLayout != null) {
uxDockingManager.RestoreLayout(Settings.Default.AvalonDockLayout.ToStream());
}
var toolboxContentPath = "WpfToolbox.xaml";
if (File.Exists(toolboxContentPath)) {
uxToolbox.Load(File.ReadAllText(toolboxContentPath));
}
}
void SaveSettings()

125
samples/XamlDesigner/MainWindow_Commands.cs

@ -4,6 +4,8 @@ using System.Linq; @@ -4,6 +4,8 @@ using System.Linq;
using System.Text;
using System.Windows.Input;
using System.Windows;
using ICSharpCode.WpfDesign.Designer;
using ICSharpCode.WpfDesign;
namespace ICSharpCode.XamlDesigner
{
@ -20,81 +22,122 @@ namespace ICSharpCode.XamlDesigner @@ -20,81 +22,122 @@ namespace ICSharpCode.XamlDesigner
ApplicationCommands.SaveAs.Text = "Save As...";
}
void NewCommand_Executed(object sender, ExecutedRoutedEventArgs e)
void RegisterCommandHandlers()
{
Shell.Instance.New();
this.AddCommandHandler(ApplicationCommands.New, Shell.Instance.New);
this.AddCommandHandler(ApplicationCommands.Open, Shell.Instance.Open);
this.AddCommandHandler(ApplicationCommands.Close, Shell.Instance.CloseCurrentDocument, HasCurrentDocument);
this.AddCommandHandler(ApplicationCommands.Save, Shell.Instance.SaveCurrentDocument, HasCurrentDocument);
this.AddCommandHandler(ApplicationCommands.SaveAs, Shell.Instance.SaveCurrentDocumentAs, HasCurrentDocument);
this.AddCommandHandler(SaveAllCommand, SaveAll, HasCurrentDocument);
this.AddCommandHandler(CloseAllCommand, CloseAll, HasCurrentDocument);
this.AddCommandHandler(ExitCommand, Shell.Instance.Exit, HasCurrentDocument);
this.AddCommandHandler(RefreshCommand, Shell.Instance.Refresh, Shell.Instance.CanRefresh);
this.AddCommandHandler(ApplicationCommands.Undo, Undo, CanUndo);
this.AddCommandHandler(ApplicationCommands.Redo, Redo, CanRedo);
this.AddCommandHandler(ApplicationCommands.Copy, Copy, CanCopy);
this.AddCommandHandler(ApplicationCommands.Cut, Cut, CanCut);
this.AddCommandHandler(ApplicationCommands.Delete, Delete, CanDelete);
this.AddCommandHandler(ApplicationCommands.Paste, Paste, CanPaste);
this.AddCommandHandler(ApplicationCommands.SelectAll, SelectAll, CanSelectAll);
}
void OpenCommand_Executed(object sender, ExecutedRoutedEventArgs e)
bool HasCurrentDocument()
{
Shell.Instance.Open();
return Shell.Instance.CurrentDocument != null;
}
void CloseCommand_Executed(object sender, ExecutedRoutedEventArgs e)
void SaveAll()
{
Shell.Instance.CloseCurrentDocument();
Shell.Instance.SaveAll();
}
void CloseCommand_PreviewExecuted(object sender, ExecutedRoutedEventArgs e)
void CloseAll()
{
Shell.Instance.CloseCurrentDocument();
Shell.Instance.CloseAll();
}
void CloseAllCommand_Executed(object sender, ExecutedRoutedEventArgs e)
ICommandService CurrentCommandService
{
Shell.Instance.CloseAll();
get
{
if (Shell.Instance.CurrentDocument != null) {
return Shell.Instance.CurrentDocument.Context.CommandService;
}
return null;
}
}
void SaveCommand_Executed(object sender, ExecutedRoutedEventArgs e)
void Undo()
{
Shell.Instance.SaveCurrentDocument();
CurrentCommandService.Undo();
}
void SaveAsCommand_Executed(object sender, ExecutedRoutedEventArgs e)
void Redo()
{
Shell.Instance.SaveCurrentDocumentAs();
CurrentCommandService.Redo();
}
void SaveAllCommand_Executed(object sender, ExecutedRoutedEventArgs e)
void Copy()
{
Shell.Instance.SaveAll();
CurrentCommandService.Copy();
}
void ExitCommand_Executed(object sender, ExecutedRoutedEventArgs e)
void Paste()
{
Shell.Instance.Exit();
CurrentCommandService.Paste();
}
void CurrentDocument_CanExecute(object sender, CanExecuteRoutedEventArgs e)
void Cut()
{
e.CanExecute = Shell.Instance.CurrentDocument != null;
CurrentCommandService.Cut();
}
void RouteDesignSurfaceCommands()
void SelectAll()
{
RouteDesignSurfaceCommand(ApplicationCommands.Undo);
RouteDesignSurfaceCommand(ApplicationCommands.Redo);
RouteDesignSurfaceCommand(ApplicationCommands.Copy);
RouteDesignSurfaceCommand(ApplicationCommands.Cut);
RouteDesignSurfaceCommand(ApplicationCommands.Paste);
RouteDesignSurfaceCommand(ApplicationCommands.SelectAll);
RouteDesignSurfaceCommand(ApplicationCommands.Delete);
CurrentCommandService.SelectAll();
}
void RouteDesignSurfaceCommand(RoutedCommand command)
void Delete()
{
var cb = new CommandBinding(command);
cb.CanExecute += delegate(object sender, CanExecuteRoutedEventArgs e) {
if (Shell.Instance.CurrentDocument != null) {
Shell.Instance.CurrentDocument.DesignSurface.RaiseEvent(e);
}else {
e.CanExecute = false;
}
};
cb.Executed += delegate(object sender, ExecutedRoutedEventArgs e) {
Shell.Instance.CurrentDocument.DesignSurface.RaiseEvent(e);
};
CommandBindings.Add(cb);
CurrentCommandService.Delete();
}
bool CanUndo()
{
return CurrentCommandService != null && CurrentCommandService.CanUndo();
}
bool CanRedo()
{
return CurrentCommandService != null && CurrentCommandService.CanRedo();
}
bool CanCopy()
{
return CurrentCommandService != null && CurrentCommandService.CanCopy();
}
bool CanPaste()
{
return CurrentCommandService != null && CurrentCommandService.CanPaste();
}
bool CanCut()
{
return CurrentCommandService != null && CurrentCommandService.CanCut();
}
bool CanSelectAll()
{
return CurrentCommandService != null && CurrentCommandService.CanSelectAll();
}
bool CanDelete()
{
return CurrentCommandService != null && CurrentCommandService.CanDelete();
}
}
}

3
samples/XamlDesigner/Properties/AssemblyInfo.cs

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
using System.Windows;
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]

110
samples/XamlDesigner/Properties/Settings.Designer.cs generated

@ -0,0 +1,110 @@ @@ -0,0 +1,110 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.3053
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ICSharpCode.XamlDesigner.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("0,0,0,0")]
public global::System.Windows.Rect MainWindowRect {
get {
return ((global::System.Windows.Rect)(this["MainWindowRect"]));
}
set {
this["MainWindowRect"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute(@"<DockingManager>
<ResizingPanel Orientation=""Horizontal"">
<ResizingPanel ResizeWidth=""200"" Orientation=""Vertical"">
<DockablePane ResizeHeight=""441.36166666666668"" Anchor=""Left"">
<DockableContent Name=""content1"" AutoHide=""false"" />
</DockablePane>
<DockablePane ResizeWidth=""200"" Anchor=""Left"">
<DockableContent Name=""content2"" AutoHide=""false"" />
</DockablePane>
</ResizingPanel>
<ResizingPanel Orientation=""Vertical"">
<DocumentPanePlaceHolder />
<DockablePane ResizeHeight=""138"" Anchor=""Bottom"">
<DockableContent Name=""content3"" AutoHide=""false"" />
</DockablePane>
</ResizingPanel>
<DockablePane ResizeWidth=""271"" Anchor=""Right"">
<DockableContent Name=""content4"" AutoHide=""false"" />
</DockablePane>
</ResizingPanel>
<Hidden />
<Windows />
</DockingManager>")]
public string AvalonDockLayout {
get {
return ((string)(this["AvalonDockLayout"]));
}
set {
this["AvalonDockLayout"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public global::System.Collections.Specialized.StringCollection RecentFiles {
get {
return ((global::System.Collections.Specialized.StringCollection)(this["RecentFiles"]));
}
set {
this["RecentFiles"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute(@"<?xml version=""1.0"" encoding=""utf-16""?>
<ArrayOfString xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
<string>%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll</string>
</ArrayOfString>")]
public global::System.Collections.Specialized.StringCollection AssemblyList {
get {
return ((global::System.Collections.Specialized.StringCollection)(this["AssemblyList"]));
}
set {
this["AssemblyList"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("Maximized")]
public global::System.Windows.WindowState MainWindowState {
get {
return ((global::System.Windows.WindowState)(this["MainWindowState"]));
}
set {
this["MainWindowState"] = value;
}
}
}
}

46
samples/XamlDesigner/Properties/Settings.settings

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="ICSharpCode.XamlDesigner.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="MainWindowRect" Type="System.Windows.Rect" Scope="User">
<Value Profile="(Default)">0,0,0,0</Value>
</Setting>
<Setting Name="AvalonDockLayout" Type="System.String" Scope="User">
<Value Profile="(Default)">&lt;DockingManager&gt;
&lt;ResizingPanel Orientation="Horizontal"&gt;
&lt;ResizingPanel ResizeWidth="200" Orientation="Vertical"&gt;
&lt;DockablePane ResizeHeight="441.36166666666668" Anchor="Left"&gt;
&lt;DockableContent Name="content1" AutoHide="false" /&gt;
&lt;/DockablePane&gt;
&lt;DockablePane ResizeWidth="200" Anchor="Left"&gt;
&lt;DockableContent Name="content2" AutoHide="false" /&gt;
&lt;/DockablePane&gt;
&lt;/ResizingPanel&gt;
&lt;ResizingPanel Orientation="Vertical"&gt;
&lt;DocumentPanePlaceHolder /&gt;
&lt;DockablePane ResizeHeight="138" Anchor="Bottom"&gt;
&lt;DockableContent Name="content3" AutoHide="false" /&gt;
&lt;/DockablePane&gt;
&lt;/ResizingPanel&gt;
&lt;DockablePane ResizeWidth="271" Anchor="Right"&gt;
&lt;DockableContent Name="content4" AutoHide="false" /&gt;
&lt;/DockablePane&gt;
&lt;/ResizingPanel&gt;
&lt;Hidden /&gt;
&lt;Windows /&gt;
&lt;/DockingManager&gt;</Value>
</Setting>
<Setting Name="RecentFiles" Type="System.Collections.Specialized.StringCollection" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="AssemblyList" Type="System.Collections.Specialized.StringCollection" Scope="User">
<Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;string&gt;%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll&lt;/string&gt;
&lt;/ArrayOfString&gt;</Value>
</Setting>
<Setting Name="MainWindowState" Type="System.Windows.WindowState" Scope="User">
<Value Profile="(Default)">Maximized</Value>
</Setting>
</Settings>
</SettingsFile>

29
samples/XamlDesigner/Properties/app.manifest

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
If you want to utilize File and Registry Virtualization for backward
compatibility then delete the requestedExecutionLevel node.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
</dependentAssembly>
</dependency>
</asmv1:assembly>

85
samples/XamlDesigner/Shell.cs

@ -5,12 +5,14 @@ using System.Text; @@ -5,12 +5,14 @@ using System.Text;
using System.ComponentModel;
using System.Collections.ObjectModel;
using ICSharpCode.WpfDesign.Designer.PropertyGrid;
using ICSharpCode.XamlDesigner.Configuration;
using ICSharpCode.XamlDesigner.Properties;
using System.Collections.Specialized;
using System.IO;
using System.Windows;
using System.Diagnostics;
using ICSharpCode.WpfDesign.Designer.Services;
using ICSharpCode.Xaml;
using ICSharpCode.WpfDesign.Designer.XamlBackend;
namespace ICSharpCode.XamlDesigner
{
@ -29,29 +31,52 @@ namespace ICSharpCode.XamlDesigner @@ -29,29 +31,52 @@ namespace ICSharpCode.XamlDesigner
public const string ApplicationTitle = "Xaml Designer";
//public Toolbox Toolbox { get; set; }
//public SceneTree SceneTree { get; set; }
public PropertyGrid PropertyGrid { get; internal set; }
//public ErrorList ErrorList { get; set; }
//public SceneTree SceneTree { get; set; }
public PropertyGrid PropertyGrid { get; internal set; }
//public ErrorList ErrorList { get; set; }
public ObservableCollection<Document> Documents { get; private set; }
public ObservableCollection<string> RecentFiles { get; private set; }
public ObservableCollection<string> RecentFiles { get; private set; }
public Dictionary<object, FrameworkElement> Views { get; private set; }
XamlProject project = new DefaultWpfProject();
public XamlProject Project
{
get { return project; }
}
Document currentDocument;
public Document CurrentDocument {
get {
public Document CurrentDocument
{
get
{
return currentDocument;
}
set {
set
{
currentDocument = value;
RaisePropertyChanged("CurrentDocument");
RaisePropertyChanged("Title");
}
}
public string Title {
get {
public DocumentView CurrentDocumentView
{
get
{
if (CurrentDocument != null) {
return Views[CurrentDocument] as DocumentView;
}
return null;
}
}
public string Title
{
get
{
if (CurrentDocument != null) {
return CurrentDocument.Title + " - " + ApplicationTitle;
}
@ -84,7 +109,7 @@ namespace ICSharpCode.XamlDesigner @@ -84,7 +109,7 @@ namespace ICSharpCode.XamlDesigner
MessageBox.Show(x.ToString());
}
public void JumpToError(XamlError error)
public void JumpToError(XamlDocumentError error)
{
if (CurrentDocument != null) {
(Views[CurrentDocument] as DocumentView).JumpToError(error);
@ -103,8 +128,10 @@ namespace ICSharpCode.XamlDesigner @@ -103,8 +128,10 @@ namespace ICSharpCode.XamlDesigner
#region Files
bool IsSomethingDirty {
get {
bool IsSomethingDirty
{
get
{
foreach (var doc in Shell.Instance.Documents) {
if (doc.IsDirty) return true;
}
@ -115,22 +142,22 @@ namespace ICSharpCode.XamlDesigner @@ -115,22 +142,22 @@ namespace ICSharpCode.XamlDesigner
static int nonameIndex = 1;
public void New()
{
Document doc = new Document("New" + nonameIndex++, File.ReadAllText("NewFileTemplate.xaml"));
Documents.Add(doc);
CurrentDocument = doc;
}
{
Document doc = new Document("New" + nonameIndex++, File.ReadAllText("NewFileTemplate.xaml"));
Documents.Add(doc);
CurrentDocument = doc;
}
public void Open()
{
{
var path = MainWindow.Instance.AskOpenFileName();
if (path != null) {
Open(path);
}
}
public void Open(string path)
{
public void Open(string path)
{
path = Path.GetFullPath(path);
if (RecentFiles.Contains(path)) {
@ -145,10 +172,10 @@ namespace ICSharpCode.XamlDesigner @@ -145,10 +172,10 @@ namespace ICSharpCode.XamlDesigner
}
}
var newDoc = new Document(path);
Documents.Add(newDoc);
CurrentDocument = newDoc;
}
var newDoc = new Document(path);
Documents.Add(newDoc);
CurrentDocument = newDoc;
}
public bool Save(Document doc)
{
@ -165,7 +192,7 @@ namespace ICSharpCode.XamlDesigner @@ -165,7 +192,7 @@ namespace ICSharpCode.XamlDesigner
{
var initName = doc.FileName ?? doc.Name + ".xaml";
var path = MainWindow.Instance.AskSaveFileName(initName);
if (path != null) {
if (path != null) {
doc.SaveAs(path);
return true;
}
@ -183,7 +210,7 @@ namespace ICSharpCode.XamlDesigner @@ -183,7 +210,7 @@ namespace ICSharpCode.XamlDesigner
public bool Close(Document doc)
{
if (doc.IsDirty) {
var result = MessageBox.Show("Save \"" + doc.Name + "\" ?", Shell.ApplicationTitle,
var result = MessageBox.Show("Save \"" + doc.Name + "\" ?", Shell.ApplicationTitle,
MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes) {
@ -211,7 +238,7 @@ namespace ICSharpCode.XamlDesigner @@ -211,7 +238,7 @@ namespace ICSharpCode.XamlDesigner
if (IsSomethingDirty) {
var result = MessageBox.Show("Save All?", Shell.ApplicationTitle,
MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes) {
if (!SaveAll()) return false;
}

2
samples/XamlDesigner/SimpleCommand.cs

@ -19,7 +19,7 @@ namespace ICSharpCode.XamlDesigner @@ -19,7 +19,7 @@ namespace ICSharpCode.XamlDesigner
Text = text;
}
public SimpleCommand(string text, Key key)
public SimpleCommand(string text, Key key)
: this(text, ModifierKeys.None, key)
{
}

10
samples/XamlDesigner/TestFiles/grid.xaml

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
<Window xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="524"
Height="385">
<ContentControl.Content>
<Grid>
<Panel.Children />
</Grid>
</ContentControl.Content>
</Window>

5
samples/XamlDesigner/Toolbox.cs

@ -4,7 +4,7 @@ using System.Linq; @@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Reflection;
using System.Collections.ObjectModel;
using ICSharpCode.XamlDesigner.Configuration;
using ICSharpCode.XamlDesigner.Properties;
using System.Windows;
using System.Collections.Specialized;
using ICSharpCode.WpfDesign;
@ -52,12 +52,15 @@ namespace ICSharpCode.XamlDesigner @@ -52,12 +52,15 @@ namespace ICSharpCode.XamlDesigner
}
Settings.Default.AssemblyList.Add(path);
}
Shell.Instance.Project.AddReference(assembly);
}
public void Remove(AssemblyNode node)
{
AssemblyNodes.Remove(node);
Settings.Default.AssemblyList.Remove(node.Path);
Shell.Instance.Project.RemoveReference(node.Assembly);
}
public void LoadSettings()

26
samples/XamlDesigner/ToolboxTreeView.cs

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ICSharpCode.WpfDesign.Designer.OutlineView;
namespace ICSharpCode.XamlDesigner
{
class ToolboxTreeView : DragTreeView
{
protected override bool CanInsert(DragTreeViewItem target, DragTreeViewItem[] items, DragTreeViewItem after, bool copy)
{
return base.CanInsert(target, items, after, copy);
}
protected override void Insert(DragTreeViewItem target, DragTreeViewItem[] items, DragTreeViewItem after, bool copy)
{
base.Insert(target, items, after, copy);
}
protected override void Remove(DragTreeViewItem target, DragTreeViewItem item)
{
base.Remove(target, item);
}
}
}

53
samples/XamlDesigner/XamlDesigner.csproj

@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<ApplicationManifest>Configuration\app.manifest</ApplicationManifest>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -90,45 +90,44 @@ @@ -90,45 +90,44 @@
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\src\Main\GlobalAssemblyInfo.cs">
<Link>Configuration\GlobalAssemblyInfo.cs</Link>
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="BitmapButton.xaml.cs">
<DependentUpon>BitmapButton.xaml</DependentUpon>
</Compile>
<Compile Include="Configuration\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Configuration\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Converters.cs" />
<Compile Include="Document.cs" />
<Compile Include="DocumentView.xaml.cs">
<DependentUpon>DocumentView.xaml</DependentUpon>
<SubType>UserControl</SubType>
</Compile>
<Compile Include="ErrorListView.xaml.cs">
<DependentUpon>ErrorListView.xaml</DependentUpon>
</Compile>
<Compile Include="ExtensionMethods.cs" />
<Compile Include="MainWindow_Commands.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Shell.cs" />
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
</Compile>
<Compile Include="SimpleCommand.cs" />
<Compile Include="Toolbox.cs" />
<Compile Include="ToolboxView.xaml.cs">
<DependentUpon>ToolboxView.xaml</DependentUpon>
</Compile>
<Compile Include="XamlFormatter.cs" />
</ItemGroup>
<ItemGroup>
<None Include="NewFileTemplate.xaml">
<SubType>Designer</SubType>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="..\..\data\options\WpfToolbox.xaml">
<Link>WpfToolbox.xaml</Link>
<SubType>Designer</SubType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Page Include="BitmapButton.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@ -161,15 +160,11 @@ @@ -161,15 +160,11 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="ToolboxView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<None Include="Configuration\app.config" />
<None Include="Configuration\app.manifest" />
<None Include="Configuration\Settings.settings">
<None Include="app.config" />
<None Include="Properties\app.manifest" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
@ -179,13 +174,17 @@ @@ -179,13 +174,17 @@
<Resource Include="Images\Tag.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\AddIns\DisplayBindings\WpfDesign\WpfDesign.XamlDom\Project\WpfDesign.XamlDom.csproj">
<Project>{88DA149F-21B2-48AB-82C4-28FB6BDFD783}</Project>
<Name>WpfDesign.XamlDom</Name>
</ProjectReference>
<Resource Include="Images\Error.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\Error.png" />
<ProjectReference Include="..\..\src\AddIns\BackendBindings\Xaml\Xaml\Xaml.csproj">
<Project>{B4E5C965-7BB9-4AE9-85FB-C47480B879AD}</Project>
<Name>Xaml</Name>
</ProjectReference>
<ProjectReference Include="..\..\src\AddIns\DisplayBindings\WpfDesign\WpfDesign.Designer\WpfDesign.Designer.csproj">
<Project>{78CC29AC-CC79-4355-B1F2-97936DF198AC}</Project>
<Name>WpfDesign.Designer</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

51
samples/XamlDesigner/app.config

@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="ICSharpCode.XamlDesigner.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<ICSharpCode.XamlDesigner.Properties.Settings>
<setting name="MainWindowRect" serializeAs="String">
<value>0,0,0,0</value>
</setting>
<setting name="AvalonDockLayout" serializeAs="String">
<value>&lt;DockingManager&gt;
&lt;ResizingPanel Orientation="Horizontal"&gt;
&lt;ResizingPanel ResizeWidth="200" Orientation="Vertical"&gt;
&lt;DockablePane ResizeHeight="441.36166666666668" Anchor="Left"&gt;
&lt;DockableContent Name="content1" AutoHide="false" /&gt;
&lt;/DockablePane&gt;
&lt;DockablePane ResizeWidth="200" Anchor="Left"&gt;
&lt;DockableContent Name="content2" AutoHide="false" /&gt;
&lt;/DockablePane&gt;
&lt;/ResizingPanel&gt;
&lt;ResizingPanel Orientation="Vertical"&gt;
&lt;DocumentPanePlaceHolder /&gt;
&lt;DockablePane ResizeHeight="138" Anchor="Bottom"&gt;
&lt;DockableContent Name="content3" AutoHide="false" /&gt;
&lt;/DockablePane&gt;
&lt;/ResizingPanel&gt;
&lt;DockablePane ResizeWidth="271" Anchor="Right"&gt;
&lt;DockableContent Name="content4" AutoHide="false" /&gt;
&lt;/DockablePane&gt;
&lt;/ResizingPanel&gt;
&lt;Hidden /&gt;
&lt;Windows /&gt;
&lt;/DockingManager&gt;</value>
</setting>
<setting name="AssemblyList" serializeAs="Xml">
<value>
<ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<string>%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.dll</string>
</ArrayOfString>
</value>
</setting>
<setting name="MainWindowState" serializeAs="String">
<value>Maximized</value>
</setting>
</ICSharpCode.XamlDesigner.Properties.Settings>
</userSettings>
</configuration>

38
src/AddIns/BackendBindings/CSharpBinding/Project/Src/CSharpCompletionBinding.cs

@ -95,6 +95,14 @@ namespace CSharpBinding @@ -95,6 +95,14 @@ namespace CSharpBinding
} else if (ch == '.') {
editor.ShowCompletionWindow(new CSharpCodeCompletionDataProvider(), ch);
return true;
} else if (ch == '>') {
if (IsInComment(editor)) return false;
char prevChar = cursor > 1 ? editor.Document.GetCharAt(cursor - 1) : ' ';
if (prevChar == '-') {
editor.ShowCompletionWindow(new PointerArrowCompletionDataProvider(), ch);
return true;
}
}
if (char.IsLetter(ch) && CodeCompletionOptions.CompleteWhenTyping) {
@ -108,7 +116,7 @@ namespace CSharpBinding @@ -108,7 +116,7 @@ namespace CSharpBinding
ExpressionResult result = ef.FindExpression(editor.Text, cursor);
LoggingService.Debug("CC: Beginning to type a word, result=" + result);
if (result.Context != ExpressionContext.IdentifierExpected) {
editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(result.Context) {
editor.ShowCompletionWindow(new CtrlSpaceCompletionDataProvider(result.Context) {
ShowTemplates = true,
AllowCompleteExistingExpression = afterUnderscore
}, '\0');
@ -131,6 +139,34 @@ namespace CSharpBinding @@ -131,6 +139,34 @@ namespace CSharpBinding
}
}
class PointerArrowCompletionDataProvider : CodeCompletionDataProvider
{
protected override ResolveResult Resolve(ExpressionResult expressionResult, int caretLineNumber, int caretColumn, string fileName, string fileContent)
{
ResolveResult rr = base.Resolve(expressionResult, caretLineNumber, caretColumn, fileName, fileContent);
if (rr != null && rr.ResolvedType != null) {
PointerReturnType prt = rr.ResolvedType.CastToDecoratingReturnType<PointerReturnType>();
if (prt != null)
return new ResolveResult(rr.CallingClass, rr.CallingMember, prt.BaseType);
}
return null;
}
protected override ExpressionResult GetExpression(ICSharpCode.TextEditor.TextArea textArea)
{
ICSharpCode.TextEditor.Document.IDocument document = textArea.Document;
IExpressionFinder expressionFinder = ParserService.GetExpressionFinder(fileName);
if (expressionFinder == null) {
return new ExpressionResult(TextUtilities.GetExpressionBeforeOffset(textArea, textArea.Caret.Offset - 1));
} else {
ExpressionResult res = expressionFinder.FindExpression(document.GetText(0, textArea.Caret.Offset - 1), textArea.Caret.Offset - 1);
if (overrideContext != null)
res.Context = overrideContext;
return res;
}
}
}
bool IsInComment(SharpDevelopTextAreaControl editor)
{
CSharpExpressionFinder ef = CreateExpressionFinder(editor.FileName);

0
src/AddIns/BackendBindings/FSharp/RequiredLibraries/FSharp.Build.Tasks.dll

11
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonConsole.cs

@ -226,6 +226,9 @@ namespace ICSharpCode.PythonBinding @@ -226,6 +226,9 @@ namespace ICSharpCode.PythonBinding
switch (keyData) {
case Keys.Back:
return !CanBackspace;
case Keys.Home:
MoveToHomePosition();
return true;
}
return false;
}
@ -283,5 +286,13 @@ namespace ICSharpCode.PythonBinding @@ -283,5 +286,13 @@ namespace ICSharpCode.PythonBinding
PythonConsoleCompletionDataProvider completionProvider = new PythonConsoleCompletionDataProvider(this);
textEditor.ShowCompletionWindow(completionProvider);
}
/// <summary>
/// The home position is at the start of the line after the prompt.
/// </summary>
void MoveToHomePosition()
{
textEditor.Column = promptLength;
}
}
}

45
src/AddIns/BackendBindings/Python/PythonBinding/Test/Console/PythonConsoleHomeKeyTestFixture.cs

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Threading;
using Microsoft.Scripting.Hosting.Shell;
using ICSharpCode.PythonBinding;
using NUnit.Framework;
namespace PythonBinding.Tests.Console
{
/// <summary>
/// The Home Key should return the user to the start of the line after the prompt.
/// </summary>
[TestFixture]
public class PythonConsoleHomeKeyTestFixture
{
MockTextEditor textEditor;
PythonConsole console;
string prompt = ">>> ";
[SetUp]
public void Init()
{
textEditor = new MockTextEditor();
console = new PythonConsole(textEditor, null);
console.Write(prompt, Style.Prompt);
}
[Test]
public void HomeKeyPressedWhenNoUserTextInConsole()
{
textEditor.RaiseDialogKeyPressEvent(Keys.Home);
int expectedColumn = prompt.Length;
Assert.AreEqual(expectedColumn, textEditor.Column);
}
}
}

1
src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj

@ -82,6 +82,7 @@ @@ -82,6 +82,7 @@
<Compile Include="Console\DerivedPythonConsoleHost.cs" />
<Compile Include="Console\DisposedPythonConsoleTestFixture.cs" />
<Compile Include="Console\CodeCompletionTests.cs" />
<Compile Include="Console\PythonConsoleHomeKeyTestFixture.cs" />
<Compile Include="Console\MockMemberProvider.cs" />
<Compile Include="Console\MockTextEditor.cs" />
<Compile Include="Console\PythonConsoleCodeCompletionTestFixture.cs" />

2
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockProjectContent.cs

@ -272,7 +272,7 @@ namespace PythonBinding.Tests.Utils @@ -272,7 +272,7 @@ namespace PythonBinding.Tests.Utils
return namespaceContents;
}
public IClass GetClass(string typeName, int typeParameterCount, LanguageProperties language, bool lookInReferences)
public IClass GetClass(string typeName, int typeParameterCount, LanguageProperties language, GetClassOptions options)
{
return GetClass(typeName, typeParameterCount);
}

7
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockTextEditorViewContent.cs

@ -6,8 +6,10 @@ @@ -6,8 +6,10 @@
// </file>
using System;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.TextEditor;
using ICSharpCode.TextEditor.Document;
namespace PythonBinding.Tests.Utils
{
@ -27,5 +29,10 @@ namespace PythonBinding.Tests.Utils @@ -27,5 +29,10 @@ namespace PythonBinding.Tests.Utils
public TextEditorControl TextEditorControl {
get { return textEditor; }
}
public IDocument GetDocumentForFile(OpenedFile file)
{
throw new NotImplementedException();
}
}
}

5
src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixPackageFilesControl.cs

@ -184,6 +184,11 @@ namespace ICSharpCode.WixBinding @@ -184,6 +184,11 @@ namespace ICSharpCode.WixBinding
}
}
public void ShowNoRootDirectoryFoundMessage()
{
ShowErrorMessage(StringParser.Parse("${res:ICSharpCode.WixBinding.PackageFilesView.NoRootDirectoryFoundMessage}"));
}
public void ShowNoSourceFileFoundMessage(string projectName)
{
ShowErrorMessage(String.Format(StringParser.Parse("${res:ICSharpCode.WixBinding.PackageFilesView.NoWixFileFoundInProjectMessage}"), projectName));

6
src/AddIns/BackendBindings/WixBinding/Project/Src/IWixPackageFilesView.cs

@ -29,6 +29,12 @@ namespace ICSharpCode.WixBinding @@ -29,6 +29,12 @@ namespace ICSharpCode.WixBinding
/// files could not be read because they contain errors.
/// </summary>
void ShowSourceFilesContainErrorsMessage();
/// <summary>
/// Displays a message indicating that no //w:Product/w:Directory[@Id="TARGETDIR"] or
/// //w:DirectoryRef[@Id="TARGETDIR"] element could be found.
/// </summary>
void ShowNoRootDirectoryFoundMessage();
/// <summary>
/// Adds the directories that will be displayed. Each directory may contain its

2
src/AddIns/BackendBindings/WixBinding/Project/Src/WixPackageFilesEditor.cs

@ -81,7 +81,7 @@ namespace ICSharpCode.WixBinding @@ -81,7 +81,7 @@ namespace ICSharpCode.WixBinding
if (errors) {
view.ShowSourceFilesContainErrorsMessage();
} else if (document == null) {
view.ShowNoSourceFileFoundMessage(project.Name);
view.ShowNoRootDirectoryFoundMessage();
} else {
SelectedElementChanged();
}

60
src/AddIns/BackendBindings/WixBinding/Test/PackageFiles/NoRootDirectoryFoundTestFixture.cs

@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.WixBinding;
using NUnit.Framework;
using System;
using System.IO;
using WixBinding.Tests.Utils;
namespace WixBinding.Tests.PackageFiles
{
/// <summary>
/// Tests that the package editor will display an error message indicating that no target directory
/// could be found the WiX files. Previously the editor would display an error message that
/// there were no WiX files - SD2-1349.
/// </summary>
[TestFixture]
public class NoRootDirectoryFoundFixture : PackageFilesTestFixtureBase
{
[TestFixtureSetUp]
public void SetUpFixture()
{
base.InitFixture();
}
[Test]
public void NoSourceFileFoundErrorNotShown()
{
Assert.IsFalse(view.IsNoSourceFileFoundMessageDisplayed);
}
[Test]
public void NoRootDirectoryFoundMessageIsShown()
{
Assert.IsTrue(view.IsNoRootDirectoryFoundMessageDisplayed);
}
/// <summary>
/// Deliberately use WiX 2.0's namespace so the test fixture will not find any
/// target directory element.
/// </summary>
protected override string GetWixXml()
{
return "<Wix xmlns=\"http://schemas.microsoft.com/wix/2003/1/wi\">\r\n" +
"\t<Product Name=\"MySetup\" \r\n" +
"\t Manufacturer=\"\" \r\n" +
"\t Id=\"F4A71A3A-C271-4BE8-B72C-F47CC956B3AA\" \r\n" +
"\t Language=\"1033\" \r\n" +
"\t Version=\"1.0.0.0\">\r\n" +
"\t\t<Package Id=\"6B8BE64F-3768-49CA-8BC2-86A76424DFE9\"/>\r\n" +
"\t</Product>\r\n" +
"</Wix>";
}
}
}

4
src/AddIns/BackendBindings/WixBinding/Test/PackageFiles/NoWixProductFileTestFixture.cs

@ -34,9 +34,9 @@ namespace WixBinding.Tests.PackageFiles @@ -34,9 +34,9 @@ namespace WixBinding.Tests.PackageFiles
}
[Test]
public void NoSourceFileFound()
public void NoRootDirectoryFound()
{
Assert.IsTrue(view.IsNoSourceFileFoundMessageDisplayed);
Assert.IsTrue(view.IsNoRootDirectoryFoundMessageDisplayed);
}
protected override string GetWixXml()

7
src/AddIns/BackendBindings/WixBinding/Test/Utils/MockTextEditorViewContent.cs

@ -6,9 +6,11 @@ @@ -6,9 +6,11 @@
// </file>
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.TextEditor;
using ICSharpCode.TextEditor.Document;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
@ -31,6 +33,11 @@ namespace WixBinding.Tests.Utils @@ -31,6 +33,11 @@ namespace WixBinding.Tests.Utils
return null;
}
}
public IDocument GetDocumentForFile(OpenedFile file)
{
return null;
}
#endregion
}

12
src/AddIns/BackendBindings/WixBinding/Test/Utils/MockWixPackageFilesView.cs

@ -19,6 +19,7 @@ namespace WixBinding.Tests.Utils @@ -19,6 +19,7 @@ namespace WixBinding.Tests.Utils
bool noSourceFileFoundMessageDisplayed;
bool sourceFilesContainErrorsMessageDisplayed;
bool noDifferencesFoundMessageDisplayed;
bool noRootDirectoryFoundMessageDisplayed;
string projectName;
WixDirectoryElement rootDirectory;
bool selectedItemAccessed;
@ -37,6 +38,11 @@ namespace WixBinding.Tests.Utils @@ -37,6 +38,11 @@ namespace WixBinding.Tests.Utils
{
}
public void ShowNoRootDirectoryFoundMessage()
{
noRootDirectoryFoundMessageDisplayed = true;
}
public void ShowNoSourceFileFoundMessage(string projectName)
{
noSourceFileFoundMessageDisplayed = true;
@ -198,6 +204,12 @@ namespace WixBinding.Tests.Utils @@ -198,6 +204,12 @@ namespace WixBinding.Tests.Utils
return noDifferencesFoundMessageDisplayed;
}
}
public bool IsNoRootDirectoryFoundMessageDisplayed {
get {
return noRootDirectoryFoundMessageDisplayed;
}
}
public WixPackageFilesDiffResult[] DiffResults {
get {

1
src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj

@ -57,6 +57,7 @@ @@ -57,6 +57,7 @@
<Compile Include="Gui\WixFileTreeNodeTestFixture.cs" />
<Compile Include="Gui\WixProjectWithWixExtensionItemsTestFixture.cs" />
<Compile Include="PackageFiles\AddFilesToDirectoryTestFixture.cs" />
<Compile Include="PackageFiles\NoRootDirectoryFoundTestFixture.cs" />
<Compile Include="Project\AddWixExtensionTestFixture.cs" />
<Compile Include="Project\AddWixLibraryTestFixture.cs" />
<Compile Include="Gui\AddWixProjectNodeTestFixture.cs" />

20
src/AddIns/BackendBindings/XamlBinding/Project/Configuration/AssemblyInfo.cs

@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using System.Reflection;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("XamlBinding")]
[assembly: AssemblyDescription("Provides XAML integration in code-completion")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

42
src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlClassReturnType.cs

@ -1,42 +0,0 @@ @@ -1,42 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.SharpDevelop.Dom;
namespace XamlBinding
{
/// <summary>
/// Description of XamlClassReturnType.
/// </summary>
public class XamlClassReturnType : ProxyReturnType
{
XamlCompilationUnit compilationUnit;
string xmlNamespace;
string className;
public XamlClassReturnType(XamlCompilationUnit compilationUnit, string xmlNamespace, string className)
{
if (compilationUnit == null)
throw new ArgumentNullException("compilationUnit");
this.compilationUnit = compilationUnit;
this.xmlNamespace = xmlNamespace;
this.className = className ?? "";
}
public override IReturnType BaseType {
get {
return compilationUnit.FindType(xmlNamespace, className);
}
}
public override string Name {
get { return className; }
}
}
}

99
src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlCodeCompletionBinding.cs

@ -1,99 +0,0 @@ @@ -1,99 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.SharpDevelop.Gui;
using System;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.TextEditor.Gui.CompletionWindow;
using ICSharpCode.XmlEditor;
namespace XamlBinding
{
public class XamlCodeCompletionBinding : ICodeCompletionBinding
{
public bool HandleKeyPress(SharpDevelopTextAreaControl editor, char ch)
{
if (ch == '<') {
editor.ShowCompletionWindow(new XamlCompletionDataProvider(XamlExpressionContext.Empty), ch);
return true;
} else if (char.IsLetter(ch)) {
int offset = editor.ActiveTextAreaControl.TextArea.Caret.Offset;
if (offset > 0) {
char c = editor.Document.GetCharAt(offset - 1);
if (c == ' ' || c == '\t') {
XmlElementPath path = XmlParser.GetActiveElementStartPathAtIndex(editor.Text, offset);
if (path != null && path.Elements.Count > 0) {
editor.ShowCompletionWindow(
new XamlCompletionDataProvider(
new XamlExpressionContext(path, "", false)
) { IsAttributeCompletion = true }
, '\0');
return false;
}
}
}
}
return false;
}
public bool CtrlSpace(SharpDevelopTextAreaControl editor)
{
XamlCompletionDataProvider provider = new XamlCompletionDataProvider();
provider.AllowCompleteExistingExpression = true;
editor.ShowCompletionWindow(provider, '\0');
return true;
}
}
sealed class XamlCompletionDataProvider : CtrlSpaceCompletionDataProvider
{
public XamlCompletionDataProvider()
{
}
public XamlCompletionDataProvider(ExpressionContext overrideContext)
: base(overrideContext)
{
}
public override CompletionDataProviderKeyResult ProcessKey(char key)
{
if (key == ':' || key == '.') {
return CompletionDataProviderKeyResult.NormalKey;
} else {
return base.ProcessKey(key);
}
}
public bool IsAttributeCompletion;
public override bool InsertAction(ICompletionData data, ICSharpCode.TextEditor.TextArea textArea, int insertionOffset, char key)
{
CodeCompletionData ccData = data as CodeCompletionData;
if (IsAttributeCompletion && ccData != null) {
textArea.Caret.Position = textArea.Document.OffsetToPosition(insertionOffset);
textArea.InsertString(ccData.Text + "=\"\"");
textArea.Caret.Column -= 1;
SharpDevelopTextAreaControl editor = textArea.MotherTextEditorControl as SharpDevelopTextAreaControl;
if (editor != null) {
WorkbenchSingleton.SafeThreadAsyncCall(
delegate {
XamlCompletionDataProvider provider = new XamlCompletionDataProvider();
provider.AllowCompleteExistingExpression = true;
editor.ShowCompletionWindow(provider, '\0');
}
);
}
return false;
} else {
return base.InsertAction(data, textArea, insertionOffset, key);
}
}
}
}

126
src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlCompilationUnit.cs

@ -1,126 +0,0 @@ @@ -1,126 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.SharpDevelop.Dom;
using System.Collections;
using System.Collections.Generic;
namespace XamlBinding
{
/// <summary>
/// Description of XamlCompilationUnit.
/// </summary>
public class XamlCompilationUnit : DefaultCompilationUnit
{
public XamlCompilationUnit(IProjectContent projectContent) : base(projectContent)
{
}
public IReturnType CreateType(string xmlNamespace, string className)
{
if (xmlNamespace.StartsWith("clr-namespace:")) {
return CreateClrNamespaceType(this.ProjectContent, xmlNamespace, className);
} else {
return new XamlClassReturnType(this, xmlNamespace, className);
}
}
static IReturnType CreateClrNamespaceType(IProjectContent pc, string xmlNamespace, string className)
{
string namespaceName = GetNamespaceNameFromClrNamespace(xmlNamespace);
return new GetClassReturnType(pc, namespaceName + "." + className, 0);
}
static string GetNamespaceNameFromClrNamespace(string xmlNamespace)
{
string namespaceName = xmlNamespace.Substring("clr-namespace:".Length);
int pos = namespaceName.IndexOf(';');
if (pos >= 0) {
// we expect that the target type is also a reference of the project, so we
// can ignore the assembly part after the ;
namespaceName = namespaceName.Substring(0, pos);
}
return namespaceName;
}
public IReturnType FindType(string xmlNamespace, string className)
{
return FindType(this.ProjectContent, xmlNamespace, className);
}
public static IReturnType FindType(IProjectContent pc, string xmlNamespace, string className)
{
if (pc == null)
throw new ArgumentNullException("pc");
if (xmlNamespace == null || className == null)
return null;
if (xmlNamespace.StartsWith("clr-namespace:")) {
return CreateClrNamespaceType(pc, xmlNamespace, className);
} else {
IReturnType type = FindTypeInAssembly(pc, xmlNamespace, className);
if (type != null)
return type;
foreach (IProjectContent p in pc.ReferencedContents) {
type = FindTypeInAssembly(p, xmlNamespace, className);
if (type != null)
return type;
}
return null;
}
}
static IReturnType FindTypeInAssembly(IProjectContent projectContent, string xmlNamespace, string className)
{
foreach (IAttribute att in projectContent.GetAssemblyAttributes()) {
if (att.PositionalArguments.Count == 2
&& att.AttributeType.FullyQualifiedName == "System.Windows.Markup.XmlnsDefinitionAttribute")
{
string namespaceName = att.PositionalArguments[1] as string;
if (xmlNamespace.Equals(att.PositionalArguments[0]) && namespaceName != null) {
IClass c = projectContent.GetClass(namespaceName + "." + className, 0, LanguageProperties.CSharp, false);
if (c != null)
return c.DefaultReturnType;
}
}
}
return null;
}
public static ArrayList GetNamespaceMembers(IProjectContent pc, string xmlNamespace)
{
if (pc == null)
throw new ArgumentNullException("pc");
if (xmlNamespace == null)
return null;
if (xmlNamespace.StartsWith("clr-namespace:")) {
return pc.GetNamespaceContents(GetNamespaceNameFromClrNamespace(xmlNamespace));
} else {
ArrayList list = new ArrayList();
AddNamespaceMembersInAssembly(pc, xmlNamespace, list);
foreach (IProjectContent p in pc.ReferencedContents) {
AddNamespaceMembersInAssembly(p, xmlNamespace, list);
}
return list;
}
}
static void AddNamespaceMembersInAssembly(IProjectContent projectContent, string xmlNamespace, ArrayList list)
{
foreach (IAttribute att in projectContent.GetAssemblyAttributes()) {
if (att.PositionalArguments.Count == 2
&& att.AttributeType.FullyQualifiedName == "System.Windows.Markup.XmlnsDefinitionAttribute")
{
string namespaceName = att.PositionalArguments[1] as string;
if (xmlNamespace.Equals(att.PositionalArguments[0]) && namespaceName != null) {
projectContent.AddNamespaceContents(list, namespaceName, projectContent.Language, false);
}
}
}
}
}
}

63
src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlExpressionContext.cs

@ -1,63 +0,0 @@ @@ -1,63 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Text;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.XmlEditor;
namespace XamlBinding
{
/// <summary>
/// Represents the context of a location in a XAML document.
/// </summary>
public sealed class XamlExpressionContext : ExpressionContext
{
public static readonly XamlExpressionContext Empty = new XamlExpressionContext(new XmlElementPath(), null, false);
public readonly XmlElementPath ElementPath;
public readonly string AttributeName;
public readonly bool InAttributeValue;
public XamlExpressionContext(XmlElementPath elementPath, string attributeName, bool inAttributeValue)
{
if (elementPath == null)
throw new ArgumentNullException("elementPath");
this.ElementPath = elementPath;
this.AttributeName = attributeName;
this.InAttributeValue = inAttributeValue;
}
public override bool ShowEntry(object o)
{
return true;
}
public override string ToString()
{
StringBuilder b = new StringBuilder();
b.Append("[XamlExpressionContext ");
for (int i = 0; i < ElementPath.Elements.Count; i ++) {
if (i > 0) b.Append(">");
if (!string.IsNullOrEmpty(ElementPath.Elements[i].Prefix)) {
b.Append(ElementPath.Elements[i].Prefix);
b.Append(':');
}
b.Append(ElementPath.Elements[i].Name);
}
if (AttributeName != null) {
b.Append(" AttributeName=");
b.Append(AttributeName);
if (InAttributeValue) {
b.Append(" InAttributeValue");
}
}
b.Append("]");
return b.ToString();
}
}
}

74
src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlExpressionFinder.cs

@ -1,74 +0,0 @@ @@ -1,74 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Text;
using System.Xml;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.XmlEditor;
namespace XamlBinding
{
/// <summary>
/// Description of XamlExpressionFinder.
/// </summary>
public class XamlExpressionFinder : IExpressionFinder
{
public static readonly XamlExpressionFinder Instance = new XamlExpressionFinder();
bool IsValidChar(char c)
{
return char.IsLetterOrDigit(c) || c == '_' || c == ':' || c == '.';
}
public ExpressionResult FindExpression(string text, int offset)
{
int pos = offset - 1;
while (pos > 0 && IsValidChar(text[pos])) {
pos--;
}
pos++;
return new ExpressionResult(text.Substring(pos, offset - pos), GetContext(text, offset));
}
public ExpressionResult FindFullExpression(string text, int offset)
{
int start = offset - 1;
while (start > 0 && IsValidChar(text[start])) {
start--;
}
start++;
while (offset < text.Length && IsValidChar(text[offset])) {
offset++;
}
return new ExpressionResult(text.Substring(start, offset - start), GetContext(text, offset));
}
public string RemoveLastPart(string expression)
{
return "";
}
ExpressionContext GetContext(string text, int offset)
{
XmlElementPath path = XmlParser.GetActiveElementStartPathAtIndex(text, offset);
if (path == null || path.Elements.Count == 0) {
if (offset > 0 && text[offset - 1] == '<')
return XamlExpressionContext.Empty;
else
return ExpressionContext.Default;
}
string attributeName = XmlParser.GetAttributeNameAtIndex(text, offset);
if (!string.IsNullOrEmpty(attributeName)) {
return new XamlExpressionContext(path, attributeName, XmlParser.IsInsideAttributeValue(text, offset));
} else {
return new XamlExpressionContext(path, null, false);
}
}
}
}

142
src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlParser.cs

@ -1,142 +0,0 @@ @@ -1,142 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Diagnostics;
using System.IO;
using System.Xml;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Dom;
namespace XamlBinding
{
/// <summary>
/// Parses xaml files to partial classes for the Dom.
/// </summary>
public class XamlParser : IParser
{
string[] lexerTags;
public string[] LexerTags {
get {
return lexerTags;
}
set {
lexerTags = value;
}
}
public LanguageProperties Language {
get {
return LanguageProperties.CSharp;
}
}
public bool CanParse(string fileName)
{
return Path.GetExtension(fileName).Equals(".xaml", StringComparison.OrdinalIgnoreCase);
}
public bool CanParse(ICSharpCode.SharpDevelop.Project.IProject project)
{
return false;
}
const string XamlNamespace = "http://schemas.microsoft.com/winfx/2006/xaml";
public ICompilationUnit Parse(IProjectContent projectContent, string fileName, string fileContent)
{
XamlCompilationUnit cu = new XamlCompilationUnit(projectContent);
cu.FileName = fileName;
try {
using (XmlTextReader r = new XmlTextReader(new StringReader(fileContent))) {
r.WhitespaceHandling = WhitespaceHandling.Significant;
r.Read();
r.MoveToContent();
DomRegion classStart = new DomRegion(r.LineNumber, r.LinePosition - 1);
string className = r.GetAttribute("Class", XamlNamespace);
if (string.IsNullOrEmpty(className)) {
LoggingService.Debug("XamlParser: returning empty cu because root element has no Class attribute");
} else {
DefaultClass c = new DefaultClass(cu, className);
c.Modifiers = ModifierEnum.Partial;
c.Region = classStart;
c.BaseTypes.Add(TypeFromXmlNode(cu, r));
cu.Classes.Add(c);
DefaultMethod initializeComponent = new DefaultMethod(
"InitializeComponent",
projectContent.SystemTypes.Void,
ModifierEnum.Public | ModifierEnum.Synthetic,
classStart, DomRegion.Empty,
c);
c.Methods.Add(initializeComponent);
ParseXamlElement(cu, c, r);
if (r.NodeType == XmlNodeType.EndElement) {
c.Region = new DomRegion(classStart.BeginLine, classStart.BeginColumn, r.LineNumber, r.LinePosition + r.Name.Length);
}
}
}
} catch (XmlException ex) {
LoggingService.Debug("XamlParser exception: " + ex.ToString());
cu.ErrorsDuringCompile = true;
}
return cu;
}
IReturnType TypeFromXmlNode(XamlCompilationUnit cu, XmlReader r)
{
return cu.CreateType(r.NamespaceURI, r.LocalName);
}
void ParseXamlElement(XamlCompilationUnit cu, DefaultClass c, XmlTextReader r)
{
Debug.Assert(r.NodeType == XmlNodeType.Element);
string name = r.GetAttribute("Name", XamlNamespace) ?? r.GetAttribute("Name");
bool isEmptyElement = r.IsEmptyElement;
if (!string.IsNullOrEmpty(name)) {
IReturnType type = TypeFromXmlNode(cu, r);
// Use position of Name attribute for field region
//if (!r.MoveToAttribute("Name", XamlNamespace)) {
// r.MoveToAttribute("Name");
//}
DomRegion position = new DomRegion(r.LineNumber, r.LinePosition, r.LineNumber, r.LinePosition + name.Length);
c.Fields.Add(new DefaultField(type, name, ModifierEnum.Internal, position, c));
}
if (isEmptyElement)
return;
while (r.Read()) {
if (r.NodeType == XmlNodeType.Element) {
ParseXamlElement(cu, c, r);
} else if (r.NodeType == XmlNodeType.Comment) {
foreach (string tag in lexerTags) {
if (r.Value.Contains(tag)) {
cu.TagComments.Add(new TagComment(r.Value, new DomRegion(r.LineNumber, r.LinePosition, r.LineNumber, r.LinePosition + r.Value.Length)));
break;
}
}
} else if (r.NodeType == XmlNodeType.EndElement) {
break;
}
}
}
public IExpressionFinder CreateExpressionFinder(string fileName)
{
return XamlExpressionFinder.Instance;
}
public IResolver CreateResolver()
{
return new XamlResolver();
}
}
}

336
src/AddIns/BackendBindings/XamlBinding/Project/Src/XamlResolver.cs

@ -1,336 +0,0 @@ @@ -1,336 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.XmlEditor;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Dom;
namespace XamlBinding
{
/// <summary>
/// Description of XamlResolver.
/// </summary>
public class XamlResolver : IResolver
{
IClass callingClass;
string resolveExpression;
XamlExpressionContext context;
ParseInformation parseInfo;
int caretLineNumber, caretColumn;
bool IsReaderAtTarget(XmlTextReader r)
{
if (r.LineNumber > caretLineNumber)
return true;
else if (r.LineNumber == caretLineNumber)
return r.LinePosition >= caretColumn;
else
return false;
}
public ResolveResult Resolve(ExpressionResult expressionResult, ParseInformation parseInfo, string fileContent)
{
this.resolveExpression = expressionResult.Expression;
this.parseInfo = parseInfo;
this.caretLineNumber = expressionResult.Region.BeginLine;
this.caretColumn = expressionResult.Region.BeginColumn;
this.callingClass = parseInfo.BestCompilationUnit.GetInnermostClass(caretLineNumber, caretColumn);
this.context = expressionResult.Context as XamlExpressionContext;
if (context == null)
return null;
try {
using (XmlTextReader r = new XmlTextReader(new StringReader(fileContent))) {
r.WhitespaceHandling = WhitespaceHandling.Significant;
// move reader to correct position
while (r.Read() && !IsReaderAtTarget(r)) { }
if (string.IsNullOrEmpty(context.AttributeName)) {
return ResolveElementName(r);
} else if (context.InAttributeValue) {
MemberResolveResult mrr = ResolveAttribute(r, context.AttributeName);
if (mrr != null) {
return ResolveAttributeValue(mrr.ResolvedMember, resolveExpression);
}
} else {
// in attribute name
return ResolveAttribute(r, resolveExpression);
}
}
return null;
} catch (XmlException) {
return null;
}
}
ResolveResult ResolveElementName(XmlReader r)
{
string xmlNamespace;
string name;
if (resolveExpression.Contains(":")) {
string prefix = resolveExpression.Substring(0, resolveExpression.IndexOf(':'));
name = resolveExpression.Substring(resolveExpression.IndexOf(':') + 1);
xmlNamespace = r.LookupNamespace(prefix);
} else {
xmlNamespace = r.LookupNamespace("");
name = resolveExpression;
}
if (name.Contains(".")) {
string propertyName = name.Substring(name.IndexOf('.') + 1);
name = name.Substring(0, name.IndexOf('.'));
return ResolveProperty(xmlNamespace, name, propertyName, true);
} else {
IProjectContent pc = parseInfo.BestCompilationUnit.ProjectContent;
IReturnType resolvedType = XamlCompilationUnit.FindType(pc, xmlNamespace, name);
IClass resolvedClass = resolvedType != null ? resolvedType.GetUnderlyingClass() : null;
if (resolvedClass != null) {
return new TypeResolveResult(callingClass, null, resolvedClass);
} else {
return null;
}
}
}
MemberResolveResult ResolveProperty(string xmlNamespace, string className, string propertyName, bool allowAttached)
{
IProjectContent pc = parseInfo.BestCompilationUnit.ProjectContent;
IReturnType resolvedType = XamlCompilationUnit.FindType(pc, xmlNamespace, className);
if (resolvedType != null && resolvedType.GetUnderlyingClass() != null) {
IMember member = resolvedType.GetProperties().Find(delegate(IProperty p) { return p.Name == propertyName; });
if (member == null) {
member = resolvedType.GetEvents().Find(delegate(IEvent p) { return p.Name == propertyName; });
}
if (member == null && allowAttached) {
member = resolvedType.GetMethods().Find(
delegate(IMethod p) {
return p.IsStatic && p.Parameters.Count == 1 && p.Name == "Get" + propertyName;
});
}
if (member != null)
return new MemberResolveResult(callingClass, null, member);
}
return null;
}
MemberResolveResult ResolveAttribute(XmlReader r, string attributeName)
{
if (context.ElementPath.Elements.Count == 0) {
return null;
}
string attributeXmlNamespace;
if (attributeName.Contains(":")) {
attributeXmlNamespace = r.LookupNamespace(attributeName.Substring(0, attributeName.IndexOf(':')));
attributeName = attributeName.Substring(attributeName.IndexOf(':') + 1);
} else {
attributeXmlNamespace = r.LookupNamespace("");
}
if (attributeName.Contains(".")) {
string className = attributeName.Substring(0, attributeName.IndexOf('.'));
attributeName = attributeName.Substring(attributeName.IndexOf('.') + 1);
return ResolveProperty(attributeXmlNamespace, className, attributeName, true);
} else {
ICSharpCode.XmlEditor.QualifiedName lastElement = context.ElementPath.Elements[context.ElementPath.Elements.Count - 1];
return ResolveProperty(lastElement.Namespace, lastElement.Name, attributeName, false);
}
}
ResolveResult ResolveAttributeValue(IMember propertyOrEvent, string expression)
{
if (propertyOrEvent == null)
return null;
if (propertyOrEvent is IEvent) {
return new MethodGroupResolveResult(callingClass, null, callingClass.DefaultReturnType, expression);
}
if (propertyOrEvent.Name == "Name" && callingClass != null) {
foreach (IField f in callingClass.Fields) {
if (f.Name == expression)
return new MemberResolveResult(callingClass, null, f);
}
}
IReturnType type = propertyOrEvent.ReturnType;
if (type == null) return null;
IClass c = type.GetUnderlyingClass();
if (c == null) return null;
if (c.ClassType == ClassType.Enum) {
foreach (IField f in c.Fields) {
if (f.Name == expression)
return new MemberResolveResult(callingClass, null, f);
}
}
return null;
}
public ArrayList CtrlSpace(int caretLineNumber, int caretColumn, ParseInformation parseInfo, string fileContent, ExpressionContext expressionContext)
{
this.parseInfo = parseInfo;
this.caretLineNumber = caretLineNumber;
this.caretColumn = caretColumn;
this.callingClass = parseInfo.BestCompilationUnit.GetInnermostClass(caretLineNumber, caretColumn);
this.context = expressionContext as XamlExpressionContext;
if (context == null) {
return null;
}
if (context.AttributeName == null) {
return CtrlSpaceForElement(fileContent);
} else if (context.InAttributeValue) {
return CtrlSpaceForAttributeValue(fileContent, context);
} else {
return CtrlSpaceForAttributeName(fileContent, context);
}
}
ArrayList CtrlSpaceForAttributeName(string fileContent, XamlExpressionContext context)
{
if (context.ElementPath.Elements.Count == 0)
return null;
QualifiedName lastElement = context.ElementPath.Elements[context.ElementPath.Elements.Count - 1];
XamlCompilationUnit cu = parseInfo.BestCompilationUnit as XamlCompilationUnit;
if (cu == null)
return null;
IReturnType rt = cu.CreateType(lastElement.Namespace, lastElement.Name);
if (rt == null)
return null;
ArrayList list = new ArrayList();
foreach (IProperty p in rt.GetProperties()) {
if (p.IsPublic && p.CanSet) {
list.Add(p);
}
}
return list;
}
ArrayList CtrlSpaceForAttributeValue(string fileContent, XamlExpressionContext context)
{
ArrayList attributes = CtrlSpaceForAttributeName(fileContent, context);
if (attributes != null) {
foreach (IProperty p in attributes.OfType<IProperty>()) {
if (p.Name == context.AttributeName && p.ReturnType != null) {
IClass c = p.ReturnType.GetUnderlyingClass();
if (c != null && c.ClassType == ClassType.Enum) {
return EnumCompletion(c);
}
}
}
}
return null;
}
ArrayList EnumCompletion(IClass enumClass)
{
ArrayList arr = new ArrayList();
foreach (IField f in enumClass.Fields) {
arr.Add(f);
}
return arr;
}
ArrayList CtrlSpaceForElement(string fileContent)
{
using (XmlTextReader r = new XmlTextReader(new StringReader(fileContent))) {
try {
r.WhitespaceHandling = WhitespaceHandling.Significant;
// move reader to correct position
while (r.Read() && !IsReaderAtTarget(r)) { }
} catch (XmlException) {
}
ArrayList result = new ArrayList();
IProjectContent pc = parseInfo.BestCompilationUnit.ProjectContent;
resolveExpression = r.Name;
TypeResolveResult rr = ResolveElementName(r) as TypeResolveResult;
if (rr != null) {
AddPropertiesForType(result, r, rr);
}
foreach (var ns in r.GetNamespacesInScope(XmlNamespaceScope.ExcludeXml)) {
ArrayList list = XamlCompilationUnit.GetNamespaceMembers(pc, ns.Value);
if (list != null) {
foreach (IClass c in list.OfType<IClass>()) {
if (c.ClassType != ClassType.Class)
continue;
if (c.IsAbstract && c.IsStatic)
continue;
if (c.ClassInheritanceTree.Any(b => b.FullyQualifiedName == "System.Attribute"))
continue;
if (!c.Methods.Any(m => m.IsConstructor && m.IsPublic))
continue;
if (string.IsNullOrEmpty(ns.Key))
result.Add(c);
else
result.Add(new XamlCompletionClass(c, ns.Key));
}
}
}
return result;
}
}
void AddPropertiesForType(ArrayList result, XmlTextReader r, TypeResolveResult rr)
{
if (rr.ResolvedType != null) {
foreach (IProperty p in rr.ResolvedType.GetProperties()) {
if (!p.IsPublic)
continue;
if (!p.CanSet && !IsCollectionType(p.ReturnType))
continue;
string propPrefix = p.DeclaringType.Name;
if (!string.IsNullOrEmpty(r.Prefix))
propPrefix = r.Prefix + ":" + propPrefix;
result.Add(new XamlCompletionProperty(p, propPrefix));
}
}
}
bool IsCollectionType(IReturnType rt)
{
if (rt == null)
return false;
return rt.GetMethods().Any(m => m.Name == "Add" && m.IsPublic);
}
class XamlCompletionClass : DefaultClass, IEntity
{
string newName;
public XamlCompletionClass(IClass baseClass, string prefix)
: base(baseClass.CompilationUnit, baseClass.FullyQualifiedName)
{
this.Modifiers = baseClass.Modifiers;
newName = prefix + ":" + baseClass.Name;
}
string IEntity.Name {
get { return newName; }
}
}
class XamlCompletionProperty : DefaultProperty, IEntity
{
string newName;
public XamlCompletionProperty(IProperty baseProperty, string prefix)
: base(baseProperty.DeclaringType, baseProperty.Name)
{
this.Modifiers = baseProperty.Modifiers;
newName = prefix + "." + baseProperty.Name;
}
string IEntity.Name {
get { return newName; }
}
}
}
}

43
src/AddIns/BackendBindings/XamlBinding/Project/XamlBinding.addin

@ -1,43 +0,0 @@ @@ -1,43 +0,0 @@
<AddIn name = "XAML binding"
author = "Daniel Grunwald"
copyright = "prj:///doc/copyright.txt"
url = "http://icsharpcode.net"
description = "Enables code-completion for xaml files.">
<!--
This file is unrelated to the WPF Designer, it is a language binding for .xaml files.
It allows using Go to definition, find references, code completion in .xaml files.
-->
<Manifest>
<Identity name = "ICSharpCode.XamlBinding"/>
<Dependency addin = "ICSharpCode.XmlEditor" requirePreload = "true"/>
</Manifest>
<Runtime>
<Import assembly = "XamlBinding.dll"/>
</Runtime>
<Path name = "/Workspace/Icons">
<Icon id = "XamlFileIcon"
extensions = ".xaml"
resource = "FileIcons.XmlIcon" />
</Path>
<Path name = "/SharpDevelop/Workbench/FileFilter">
<FileFilter id = "Xaml"
insertbefore="AllFiles"
name = "Xaml files (*.xaml)"
extensions = "*.xaml"/>
</Path>
<Path name = "/Workspace/Parser">
<Parser id = "XAML"
supportedextensions = ".xaml"
class = "XamlBinding.XamlParser"/>
</Path>
<Path name = "/AddIns/DefaultTextEditor/CodeCompletion">
<CodeCompletionBinding id = "Xaml" extensions = ".xaml" class = "XamlBinding.XamlCodeCompletionBinding"/>
</Path>
</AddIn>

94
src/AddIns/BackendBindings/XamlBinding/Project/XamlBinding.csproj

@ -1,94 +0,0 @@ @@ -1,94 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<ProjectGuid>{7C96B65D-28A5-4F28-A35B-8D83CE831EE8}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<RootNamespace>XamlBinding</RootNamespace>
<AssemblyName>XamlBinding</AssemblyName>
<OutputPath>..\..\..\..\..\AddIns\AddIns\BackendBindings\XamlBinding</OutputPath>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<SourceAnalysisOverrideSettingsFile>C:\Users\Daniel\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<Optimize>False</Optimize>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Configuration" />
<Folder Include="Src" />
<None Include="XamlBinding.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\XamlClassReturnType.cs" />
<Compile Include="Src\XamlCodeCompletionBinding.cs" />
<Compile Include="Src\XamlCompilationUnit.cs" />
<Compile Include="Src\XamlExpressionContext.cs" />
<Compile Include="Src\XamlExpressionFinder.cs" />
<Compile Include="Src\XamlParser.cs" />
<Compile Include="Src\XamlResolver.cs" />
<ProjectReference Include="..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj">
<Project>{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}</Project>
<Name>ICSharpCode.TextEditor</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Libraries\NRefactory\Project\NRefactory.csproj">
<Project>{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}</Project>
<Name>NRefactory</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj">
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project>
<Name>ICSharpCode.SharpDevelop.Dom</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\DisplayBindings\XmlEditor\Project\XmlEditor.csproj">
<Project>{6B717BD1-CD5E-498C-A42E-9E6A4584DC48}</Project>
<Name>XmlEditor</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
</Project>

16
src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/Properties/AssemblyInfo.cs

@ -1,16 +0,0 @@ @@ -1,16 +0,0 @@
#region Using directives
using System;
using System.Reflection;
using System.Runtime.InteropServices;
#endregion
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("XamlBinding.Tests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

75
src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XamlBinding.Tests.csproj

@ -1,75 +0,0 @@ @@ -1,75 +0,0 @@
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{F390DA70-1FE1-4715-81A0-389AB010C130}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<RootNamespace>XamlBinding.Tests</RootNamespace>
<AssemblyName>XamlBinding.Tests</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<AppDesignerFolder>Properties</AppDesignerFolder>
<SourceAnalysisOverrideSettingsFile>C:\Users\Daniel\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile>
<OutputPath>..\..\..\..\..\bin\UnitTests\</OutputPath>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="nunit.framework">
<HintPath>..\..\..\..\Tools\NUnit\nunit.framework.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Properties\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="XamlExpressionFinderTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj">
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project>
<Name>ICSharpCode.SharpDevelop.Dom</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\DisplayBindings\XmlEditor\Project\XmlEditor.csproj">
<Project>{6B717BD1-CD5E-498C-A42E-9E6A4584DC48}</Project>
<Name>XmlEditor</Name>
</ProjectReference>
<ProjectReference Include="..\Project\XamlBinding.csproj">
<Project>{7C96B65D-28A5-4F28-A35B-8D83CE831EE8}</Project>
<Name>XamlBinding</Name>
</ProjectReference>
</ItemGroup>
</Project>

48
src/AddIns/BackendBindings/XamlBinding/XamlBinding.Tests/XamlExpressionFinderTests.cs

@ -1,48 +0,0 @@ @@ -1,48 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.SharpDevelop.Dom;
using System;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
namespace XamlBinding.Tests
{
[TestFixture]
public class XamlExpressionFinderTests
{
XamlExpressionContext GetXamlContext(string text)
{
return (XamlExpressionContext)GetContext(text);
}
ExpressionContext GetContext(string text)
{
return XamlExpressionFinder.Instance.FindExpression(text, text.Length).Context;
}
[Test]
public void FindContextAfterElementName()
{
XamlExpressionContext c = GetXamlContext("<Window><Grid");
Assert.AreEqual(2, c.ElementPath.Elements.Count);
Assert.AreEqual("Window > Grid", c.ElementPath.ToString());
Assert.IsNull(c.AttributeName);
Assert.IsFalse(c.InAttributeValue);
}
[Test]
public void FindContextAtElementStart()
{
XamlExpressionContext c = GetXamlContext("<Window><");
Assert.AreEqual(0, c.ElementPath.Elements.Count);
Assert.IsNull(c.AttributeName);
Assert.IsFalse(c.InAttributeValue);
}
}
}

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

@ -53,10 +53,10 @@ @@ -53,10 +53,10 @@
</Path>
<Path name="/SharpDevelop/ViewContent/ClassDiagram/ContextMenu">
<!--
<MenuItem id = "AddItem"
label = "Add"
type = "Menu">
<MenuItem id = "AddClassItem"
label = "Class"
class = "ClassDiagramAddin.AddClassCommand"/>
@ -81,6 +81,10 @@ @@ -81,6 +81,10 @@
label = "Note"
class = "ClassDiagramAddin.AddNoteCommand"/>
</MenuItem>
-->
<MenuItem id = "AddNoteItem"
label = "Add Note"
class = "ClassDiagramAddin.AddNoteCommand"/>
<MenuItem type = "Separator" />
@ -138,14 +142,5 @@ @@ -138,14 +142,5 @@
title = "Class Diagram"/>
</Path>
<Path name = "/SharpDevelop/Workbench/Pads">
<Pad id = "ClassEditorPad"
category = "Tools"
title = "Class Editor"
class = "ClassDiagramAddin.ClassEditorPad"
icon = "ClassDiagram.ClassEditor"
defaultPosition = "Right, Hidden" />
</Path>
<BitmapResources file="Resources\Bitmaps.resources" />
</AddIn>

5
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/ClassDiagramAddin.csproj

@ -54,7 +54,6 @@ @@ -54,7 +54,6 @@
</Compile>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\ClassDiagramViewContent.cs" />
<Compile Include="Src\ClassEditorPad.cs" />
<Compile Include="Src\SaveToBitmapCommand.cs" />
<Compile Include="Src\ShowClassDiagramCommand.cs" />
<Compile Include="Src\ClassDiagramDisplayBinding.cs" />
@ -101,10 +100,6 @@ @@ -101,10 +100,6 @@
<Project>{08F772A1-F0BE-433E-8B37-F6522953DB05}</Project>
<Name>ClassCanvas</Name>
</ProjectReference>
<ProjectReference Include="..\ClassEditor\ClassEditor.csproj">
<Project>{F5E059BB-96C2-4398-BED0-8598CD434173}</Project>
<Name>ClassEditor</Name>
</ProjectReference>
<ProjectReference Include="..\DiagramRouter\Diagrams.csproj">
<Project>{0991423A-DBF6-4C89-B365-A1DF1EB32E42}</Project>
<Name>Diagrams</Name>

14
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ClassDiagramViewContent.cs

@ -41,7 +41,6 @@ namespace ClassDiagramAddin @@ -41,7 +41,6 @@ namespace ClassDiagramAddin
toolstrip.Stretch = true;
canvas.Controls.Add(toolstrip);
canvas.ContextMenuStrip = MenuService.CreateContextMenu(this, "/SharpDevelop/ViewContent/ClassDiagram/ContextMenu");
canvas.CanvasItemSelected += HandleItemSelected;
}
public override object Content {
@ -148,18 +147,5 @@ namespace ClassDiagramAddin @@ -148,18 +147,5 @@ namespace ClassDiagramAddin
{
this.PrimaryFile.MakeDirty();
}
private void HandleItemSelected (object sender, CanvasItemEventArgs args)
{
ClassCanvasItem cci = args.CanvasItem as ClassCanvasItem;
if (cci != null)
{
PadDescriptor padDesc = WorkbenchSingleton.Workbench.GetPad(typeof(ClassEditorPad));
if (padDesc != null)
{
((ClassEditor)padDesc.PadContent.Content).SetClass(cci.RepresentedClassType);
}
}
}
}
}

182
src/AddIns/DisplayBindings/ClassDiagram/ClassDiagramAddin/Src/ClassEditorPad.cs

@ -1,182 +0,0 @@ @@ -1,182 +0,0 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 12/13/2006
* Time: 2:12 PM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Windows.Forms;
using System.Collections.Generic;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Dom.Refactoring;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Refactoring;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.TextEditor;
using ICSharpCode.NRefactory.Ast;
using ClassDiagram;
namespace ClassDiagramAddin
{
/// <summary>
/// Description of the pad content
/// </summary>
public class ClassEditorPad : AbstractPadContent
{
ClassEditor editor = new ClassEditor();
/// <summary>
/// Creates a new ClassEditorPad object
/// </summary>
public ClassEditorPad()
{
editor.MemberActivated += EditorMemberActivated;
editor.MemberModified += EditorMemberModified;
editor.ParameterActivated += EditorParameterActivated;
editor.ParameterModified += EditorParameterModified;
editor.ClassMemberAdded += EditorClassMemberAdded;
}
private void EditorMemberActivated (object sender, IMemberEventArgs e)
{
ICompilationUnit compUnit = e.Member.DeclaringType.CompilationUnit;
FileService.JumpToFilePosition(compUnit.FileName,
e.Member.Region.BeginLine - 1,
e.Member.Region.BeginColumn - 1);
}
private void EditorParameterActivated (object sender, IParameterEventArgs e)
{
ICompilationUnit compUnit = e.Method.DeclaringType.CompilationUnit;
FileService.JumpToFilePosition(compUnit.FileName,
e.Parameter.Region.BeginLine - 1,
e.Parameter.Region.BeginColumn);
}
private void EditorClassMemberAdded (object sender, IMemberEventArgs e)
{
AbstractNode memberDom = null;
DomRegion cRegion = e.Member.DeclaringType.BodyRegion;
if (cRegion.IsEmpty) cRegion = e.Member.DeclaringType.Region;
memberDom = CodeGenerator.ConvertMember(e.Member, new ClassFinder(e.Member.DeclaringType, cRegion.BeginLine + 1, 1));
IProject proj = ProjectService.CurrentProject;
IViewContent vc = FileService.OpenFile(e.Member.DeclaringType.CompilationUnit.FileName);
if (vc == null) return;
IDocument doc = GetDocument(vc);
if (e.Member.DeclaringType is CompoundClass)
{
foreach (IClass c in ((CompoundClass)e.Member.DeclaringType).Parts)
{
System.Diagnostics.Debug.WriteLine(c.Name+": " +c.Modifiers.ToString());
}
}
proj.LanguageProperties.CodeGenerator.InsertCodeAtEnd(cRegion, doc, memberDom);
}
private static IDocument GetDocument(IViewContent viewContent)
{
ITextEditorControlProvider provider1 = viewContent as ITextEditorControlProvider;
if (provider1 == null)
{
return null;
}
return new TextEditorDocument (provider1.TextEditorControl.Document);
}
private void EditorMemberModified (object sender, IMemberModificationEventArgs e)
{
switch (e.Modification)
{
case Modification.Name:
DialogResult dr = MessageBox.Show("Rename all occurances?", "Rename Member", MessageBoxButtons.YesNoCancel);
if (dr == DialogResult.Cancel) e.Cancel = true;
else if (dr == DialogResult.Yes)
{
FindReferencesAndRenameHelper.RenameMember(e.Member, e.NewValue);
}
else
{
// TODO - place local renameing code here.
}
break;
case Modification.Type:
// TODO - place type replacment code here.
break;
case Modification.Modifier:
// TODO - place visibility replacment code here.
break;
case Modification.Summary:
// TODO - place summary replacment code here.
break;
}
}
private void EditorParameterModified (object sender, IParameterModificationEventArgs e)
{
switch (e.Modification)
{
case Modification.Name:
DialogResult dr = MessageBox.Show("Rename all occurances?", "Rename Parameter", MessageBoxButtons.YesNoCancel);
if (dr == DialogResult.Cancel) e.Cancel = true;
else if (dr == DialogResult.Yes)
{
ResolveResult local = new LocalResolveResult(e.Method, new DefaultField.ParameterField(e.Parameter.ReturnType, e.Parameter.Name, e.Parameter.Region, e.Method.DeclaringType));
List<Reference> list = RefactoringService.FindReferences(local, null);
if (list == null) return;
FindReferencesAndRenameHelper.RenameReferences(list, e.NewValue);
}
else
{
// TODO - place local renameing code here.
}
break;
case Modification.Type:
// TODO - place type replacment code here.
break;
case Modification.Modifier:
// TODO - place visibility replacment code here.
break;
case Modification.Summary:
// TODO - place summary replacment code here.
break;
}
}
/// <summary>
/// The <see cref="System.Windows.Forms.Control"/> representing the pad
/// </summary>
public override object Content
{
get { return editor; }
}
/// <summary>
/// Cleans up all used resources
/// </summary>
public override void Dispose()
{
editor.Dispose();
}
private static TextEditorControl GetTextEditorControl()
{
ITextEditorControlProvider provider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorControlProvider;
if (provider != null)
return provider.TextEditorControl;
else
return null;
}
}
}

22
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/AssemblyInfo.cs

@ -1,22 +0,0 @@ @@ -1,22 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// <version>$Revision$</version>
// </file>
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("ClassEditor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

177
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ClassEditor.Designer.cs generated

@ -1,177 +0,0 @@ @@ -1,177 +0,0 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 20/10/2006
* Time: 20:08
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
namespace ClassDiagram
{
partial class ClassEditor : System.Windows.Forms.UserControl
{
/// <summary>
/// Designer variable used to keep track of non-visual components.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Disposes resources used by the form.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing) {
if (components != null) {
components.Dispose();
}
}
base.Dispose(disposing);
}
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent()
{
this.membersList = new Aga.Controls.Tree.TreeViewAdv();
this.nameCol = new Aga.Controls.Tree.TreeColumn();
this.typeCol = new Aga.Controls.Tree.TreeColumn();
this.modifierCol = new Aga.Controls.Tree.TreeColumn();
this.summaryCol = new Aga.Controls.Tree.TreeColumn();
this._icon = new Aga.Controls.Tree.NodeControls.NodeIcon();
this._name = new Aga.Controls.Tree.NodeControls.NodeTextBox();
this._type = new Aga.Controls.Tree.NodeControls.NodeComboBox();
this._modifiers = new Aga.Controls.Tree.NodeControls.NodeComboBox();
this._summary = new Aga.Controls.Tree.NodeControls.NodeTextBox();
this._paramModifiers = new Aga.Controls.Tree.NodeControls.NodeComboBox();
this.SuspendLayout();
//
// membersList
//
this.membersList.BackColor = System.Drawing.SystemColors.Window;
this.membersList.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.membersList.Columns.Add(this.nameCol);
this.membersList.Columns.Add(this.typeCol);
this.membersList.Columns.Add(this.modifierCol);
this.membersList.Columns.Add(this.summaryCol);
this.membersList.Cursor = System.Windows.Forms.Cursors.Default;
this.membersList.DefaultToolTipProvider = null;
this.membersList.Dock = System.Windows.Forms.DockStyle.Fill;
this.membersList.DragDropMarkColor = System.Drawing.Color.Black;
this.membersList.FullRowSelect = true;
this.membersList.LineColor = System.Drawing.SystemColors.ControlDark;
this.membersList.Location = new System.Drawing.Point(0, 0);
this.membersList.Model = null;
this.membersList.Name = "membersList";
this.membersList.NodeControls.Add(this._icon);
this.membersList.NodeControls.Add(this._name);
this.membersList.NodeControls.Add(this._type);
this.membersList.NodeControls.Add(this._modifiers);
this.membersList.NodeControls.Add(this._summary);
this.membersList.NodeControls.Add(this._paramModifiers);
this.membersList.SelectedNode = null;
this.membersList.ShowLines = false;
this.membersList.Size = new System.Drawing.Size(603, 299);
this.membersList.TabIndex = 0;
this.membersList.Text = "treeViewAdv1";
this.membersList.UseColumns = true;
this.membersList.NodeMouseDoubleClick += new System.EventHandler<Aga.Controls.Tree.TreeNodeAdvMouseEventArgs>(this.MembersListNodeMouseDoubleClick);
//
// nameCol
//
this.nameCol.Header = "Name";
this.nameCol.SortOrder = System.Windows.Forms.SortOrder.None;
this.nameCol.Width = 80;
//
// typeCol
//
this.typeCol.Header = "Type";
this.typeCol.SortOrder = System.Windows.Forms.SortOrder.None;
this.typeCol.Width = 80;
//
// modifierCol
//
this.modifierCol.Header = "Modifier";
this.modifierCol.SortOrder = System.Windows.Forms.SortOrder.None;
this.modifierCol.Width = 80;
//
// summaryCol
//
this.summaryCol.Header = "Summary";
this.summaryCol.SortOrder = System.Windows.Forms.SortOrder.None;
this.summaryCol.Width = 320;
//
// _icon
//
this._icon.DataPropertyName = "MemberIcon";
this._icon.IncrementalSearchEnabled = false;
this._icon.ParentColumn = this.nameCol;
//
// _name
//
this._name.DataPropertyName = "MemberName";
this._name.EditEnabled = true;
this._name.ParentColumn = this.nameCol;
this._name.Trimming = System.Drawing.StringTrimming.EllipsisCharacter;
this._name.DrawText += new System.EventHandler<Aga.Controls.Tree.NodeControls.DrawEventArgs>(this._nameDrawText);
//
// _type
//
this._type.DataPropertyName = "MemberType";
this._type.EditEnabled = true;
this._type.ParentColumn = this.typeCol;
this._type.Trimming = System.Drawing.StringTrimming.EllipsisCharacter;
//
// _modifiers
//
this._modifiers.DataPropertyName = "MemberModifier";
this._modifiers.DropDownItems.Add("Public");
this._modifiers.DropDownItems.Add("Private");
this._modifiers.DropDownItems.Add("Protected");
this._modifiers.DropDownItems.Add("Internal");
this._modifiers.EditEnabled = true;
this._modifiers.ParentColumn = this.modifierCol;
this._modifiers.Trimming = System.Drawing.StringTrimming.EllipsisCharacter;
//
// _summary
//
this._summary.DataPropertyName = "MemberSummary";
this._summary.EditEnabled = true;
this._summary.ParentColumn = this.summaryCol;
this._summary.Trimming = System.Drawing.StringTrimming.EllipsisCharacter;
//
// _paramModifiers
//
this._paramModifiers.DataPropertyName = "MemberModifier";
this._paramModifiers.DropDownItems.Add("In");
this._paramModifiers.DropDownItems.Add("Out");
this._paramModifiers.DropDownItems.Add("Ref");
this._paramModifiers.DropDownItems.Add("Params");
this._paramModifiers.DropDownItems.Add("Optional");
this._paramModifiers.ParentColumn = this.modifierCol;
//
// ClassEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.membersList);
this.Name = "ClassEditor";
this.Size = new System.Drawing.Size(603, 299);
this.ResumeLayout(false);
}
private Aga.Controls.Tree.NodeControls.NodeComboBox _paramModifiers;
private Aga.Controls.Tree.NodeControls.NodeIcon _icon;
private Aga.Controls.Tree.NodeControls.NodeComboBox _modifiers;
private Aga.Controls.Tree.NodeControls.NodeComboBox _type;
private Aga.Controls.Tree.NodeControls.NodeTextBox _summary;
private Aga.Controls.Tree.NodeControls.NodeTextBox _name;
private Aga.Controls.Tree.TreeViewAdv membersList;
private Aga.Controls.Tree.TreeColumn nameCol;
private Aga.Controls.Tree.TreeColumn typeCol;
private Aga.Controls.Tree.TreeColumn modifierCol;
private Aga.Controls.Tree.TreeColumn summaryCol;
}
}

577
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ClassEditor.cs

@ -1,577 +0,0 @@ @@ -1,577 +0,0 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 20/10/2006
* Time: 20:08
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Xml;
using System.Xml.XPath;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.TextEditor;
using Aga.Controls.Tree;
using Aga.Controls.Tree.NodeControls;
namespace ClassDiagram
{
public partial class ClassEditor
{
VisibilityModifiersEditor visibilityModifierEditor = new VisibilityModifiersEditor();
ParameterModifiersEditor parameterModifierEditor = new ParameterModifiersEditor();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(ClassEditor));
Dictionary<Type, Node> addMemberItems = new Dictionary<Type, Node>();
Dictionary<IMethod, Node> addParameterItems = new Dictionary<IMethod, Node>();
Dictionary<ClassType, Action<IClass>> classTypeGroupCreators = new Dictionary<ClassType, Action<IClass>>();
IClass currClass;
public event EventHandler<IMemberEventArgs> MemberActivated = delegate {};
public event EventHandler<IParameterEventArgs> ParameterActivated = delegate {};
public event EventHandler<IMemberModificationEventArgs> MemberModified = delegate {};
public event EventHandler<IParameterModificationEventArgs> ParameterModified = delegate {};
public event EventHandler<IMemberEventArgs> ClassMemberAdded = delegate {};
TreeModel model = new TreeModel();
private class GroupNode : Node
{
public GroupNode(Type groupType, string title)
: base (title)
{
this.groupType = groupType;
}
Type groupType;
public Type GroupType {
get { return groupType; }
}
public string MemberName
{
get { return base.Text; }
}
}
private class MemberNode : Node
{
public MemberNode(IMember member, IAmbience ambience, ClassEditor editor)
{
this.member = member;
this.ambience = ambience;
this.editor = editor;
UpdateValues();
}
void UpdateValues()
{
IMethod methodMember = member as IMethod;
IEvent eventMember = member as IEvent;
IProperty propertyMember = member as IProperty;
IField fieldMember = member as IField;
int iconIndex = -1;
try
{
iconIndex = ClassBrowserIconService.GetIcon(member);
}
catch {}
if (iconIndex > -1)
icon = ClassBrowserIconService.ImageList.Images[iconIndex];
if (methodMember != null) memberName = ambience.Convert(methodMember);
if (eventMember != null) memberName = ambience.Convert(eventMember);
if (propertyMember != null) memberName = ambience.Convert(propertyMember);
if (fieldMember != null) memberName = ambience.Convert(fieldMember);
}
IAmbience ambience;
IMember member;
ClassEditor editor;
public IMember Member
{
get { return member; }
set { member = value; UpdateValues(); }
}
private string memberName;
public string MemberName
{
get { return memberName; }
set
{
IMemberModificationEventArgs mmea = new IMemberModificationEventArgs(member, Modification.Name, value);
editor.EmitMemberModified(mmea);
}
}
protected Image icon;
public Image MemberIcon
{
get { return icon; }
}
public string MemberType
{
get { return ambience.Convert(member.ReturnType); }
set
{
IMemberModificationEventArgs mmea = new IMemberModificationEventArgs(member, Modification.Type, value);
editor.EmitMemberModified(mmea);
}
}
public string MemberModifiers
{
get { return member.Modifiers.ToString(); }
set
{
IMemberModificationEventArgs mmea = new IMemberModificationEventArgs(member, Modification.Modifier, value);
editor.EmitMemberModified(mmea);
}
}
public string MemberSummary
{
get { return ClassEditor.GetSummary(member); }
set
{
IMemberModificationEventArgs mmea = new IMemberModificationEventArgs(member, Modification.Summary, value);
editor.EmitMemberModified(mmea);
}
}
}
private class ParameterNode : Node
{
public ParameterNode(IMethod method, IParameter parameter, IAmbience ambience, Image icon, ClassEditor editor)
{
this.ambience = ambience;
this.icon = icon;
this.parameter = parameter;
this.editor = editor;
this.method = method;
}
IAmbience ambience;
IParameter parameter;
IMethod method;
ClassEditor editor;
Image icon;
public IParameter Parameter {
get { return parameter; }
set { parameter = value; }
}
public IMethod Method {
get { return method; }
set { method = value; }
}
public string MemberName
{
get { return parameter.Name; }
set
{
IParameterModificationEventArgs pmea = new IParameterModificationEventArgs(method, parameter, Modification.Name, value);
editor.EmitParameterModified(pmea);
}
}
public Image MemberIcon
{
get { return icon; }
set { icon = value; }
}
public string MemberType
{
get { return ambience.Convert(parameter.ReturnType); }
set
{
IParameterModificationEventArgs pmea = new IParameterModificationEventArgs(method, parameter, Modification.Type, value);
editor.EmitParameterModified(pmea);
}
}
public string MemberModifiers
{
get { return parameter.Modifiers.ToString(); }
set
{
IParameterModificationEventArgs pmea = new IParameterModificationEventArgs(method, parameter, Modification.Modifier, value);
editor.EmitParameterModified(pmea);
}
}
public string MemberSummary
{
get { return ClassEditor.GetParameterSummary(method, parameter.Name); }
set
{
IParameterModificationEventArgs pmea = new IParameterModificationEventArgs(method, parameter, Modification.Summary, value);
editor.EmitParameterModified(pmea);
}
}
}
private class AddMemberNode : Node
{
public AddMemberNode (string str) : base (str) {}
public string MemberName {
get { return base.Text; }
}
}
private class AddParameterNode : Node
{
public AddParameterNode (Image icon) : base ("<Add Parameter>")
{
this.icon = icon;
}
Image icon;
public Image MemberIcon {
get { return icon; }
}
public string MemberName {
get { return base.Text; }
}
}
public ClassEditor()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
membersList.Model = model;
classTypeGroupCreators.Add(ClassType.Class, SetClassGroups);
classTypeGroupCreators.Add(ClassType.Interface, SetClassGroups);
classTypeGroupCreators.Add(ClassType.Struct, SetClassGroups);
classTypeGroupCreators.Add(ClassType.Module, SetClassGroups);
classTypeGroupCreators.Add(ClassType.Enum, SetEnumGroups);
classTypeGroupCreators.Add(ClassType.Delegate, SetDelegateGroups);
}
private void InitTypeList()
{
_type.DropDownItems.Clear();
IProjectContent pc = ProjectService.CurrentProject.CreateProjectContent();
foreach (IClass c in pc.Classes)
_type.DropDownItems.Add(c.Name);
_type.DropDownItems.Sort();
}
private void HandleDoubleClick (object sender, EventArgs e)
{
}
internal void EmitMemberModified(IMemberModificationEventArgs e)
{
MemberModified(this, e);
}
internal void EmitParameterModified(IParameterModificationEventArgs e)
{
ParameterModified(this, e);
}
/*
private void AfterEdit (object sender, TreeListViewLabelEditEventArgs e)
{
IProjectContent pc = ProjectService.CurrentProject.CreateProjectContent();
IMember member = null;
if (addMemberItems.ContainsValue(editedItem))
{
Type parentGroupType = editedItem.Parent.Tag as Type;
if (parentGroupType == typeof(IMethod))
{
member = new DefaultMethod(currClass, e.Label);
member.ReturnType = pc.SystemTypes.Void;
}
else if (parentGroupType == typeof(IField))
{
member = new DefaultField(currClass, e.Label);
if (currClass.ClassType == ClassType.Enum)
member.ReturnType = pc.SystemTypes.Int32;
else
member.ReturnType = pc.SystemTypes.Object;
}
else if (parentGroupType == typeof(IProperty))
{
member = new DefaultProperty(currClass, e.Label);
member.ReturnType = pc.SystemTypes.Object;
}
else if (parentGroupType == typeof(IEvent))
{
member = new DefaultEvent(currClass, e.Label);
member.ReturnType = pc.SystemTypes.CreatePrimitive(typeof(EventHandler));
}
ConvertAddItemToMemberItem(editedItem, member, GetAmbience());
AddAddItem(parentGroupType, editedItem.Parent);
IReturnType memberType = VoidReturnType.Instance;
IMemberEventArgs memberargs = new IMemberEventArgs(member);
ClassMemberAdded(this, memberargs);
return;
}
}
*/
private void SetClassGroups (IClass classType)
{
AddGroup<IMethod>("Methods", classType.Methods);
AddGroup<IProperty>("Properties", classType.Properties);
AddGroup<IField>("Fields", classType.Fields);
AddGroup<IEvent>("Events", classType.Events);
}
private void SetEnumGroups (IClass classType)
{
AddGroup<IField>("Fields", classType.Fields);
}
private void SetDelegateGroups (IClass classType)
{
}
public void SetClass (IClass classType)
{
membersList.BeginUpdate();
model.Nodes.Clear();
currClass = classType;
if (classType != null)
classTypeGroupCreators[classType.ClassType](classType);
membersList.EndUpdate();
}
private Node AddGroup<MT>(string title, ICollection<MT> members) where MT : IMember
{
if (members == null) return null;
GroupNode group = new GroupNode(typeof(MT), title);
//TreeListViewItem group = new TreeListViewItem(title);
// group.ForeColor = Color.Gray;
// group.Font = new Font(group.Font, FontStyle.Bold);
// group.Items.Sortable = false;
// group.Tag = typeof(MT);
IAmbience ambience = GetAmbience();
if (members.Count != 0)
{
foreach (IMember member in members)
{
MemberNode memberItem = CreateMemberItem(member, ambience);
group.Nodes.Add(memberItem);
IMethod methodMember = memberItem.Member as IMethod;
if (methodMember != null)
FillParams (memberItem, methodMember);
}
}
AddAddItem(typeof(MT), group);
model.Nodes.Add(group);
return group;
}
private MemberNode CreateMemberItem(IMember member, IAmbience ambience)
{
MemberNode memberItem = new MemberNode(member, ambience, this);
return memberItem;
}
private void AddAddItem(Type memberType, GroupNode group)
{
string str = "";
if (memberType == typeof(IMethod)) str = "<Add Method>";
else if (memberType == typeof(IEvent)) str = "<Add Event>";
else if (memberType == typeof(IProperty)) str = "<Add Property>";
else if (memberType == typeof(IField)) str = "<Add Field>";
AddMemberNode addNewMember = new AddMemberNode(str); // TODO set color
//addNewMember.ForeColor = SystemColors.GrayText;
group.Nodes.Add(addNewMember);
addMemberItems[memberType] = addNewMember;
}
private void ConvertAddItemToMemberItem(Node addItem, IMember member, IAmbience ambience)
{
//addItem.
// addItem.ForeColor = SystemColors.ControlText;
// addItem.SubItems.Add(ambience.Convert(member.ReturnType));
// addItem.SubItems.Add(member.Modifiers.ToString());
// addItem.SubItems.Add(GetSummary(member));
}
private static string GetSummary (IEntity decoration)
{
if (decoration == null) return String.Empty;
return GetSummary(decoration.Documentation, @"/docroot/summary");
}
private static string GetParameterSummary (IEntity decoration, string parameterName)
{
if (decoration == null) return String.Empty;
return GetSummary(decoration.Documentation, @"/docroot/param[@name='"+parameterName+"']");
}
private static string GetSummary (string documentation, string xpath)
{
StringReader strReader = new StringReader("<docroot>" + documentation + "</docroot>");
XmlDocument doc = new XmlDocument();
doc.Load(strReader);
XPathNavigator nav = doc.CreateNavigator();
XPathNodeIterator ni = nav.Select(xpath);
if (ni.MoveNext())
return ni.Current.InnerXml;
else
return String.Empty;
}
private void FillParams(MemberNode item, IMethod method)
{
Image comma = (Image)resources.GetObject("ClassEditor.Comma");
Image openBrace = (Image)resources.GetObject("ClassEditor.OpenBrace");
Image closeBrace = (Image)resources.GetObject("ClassEditor.CloseBrace");
Image emptyBraces = (Image)resources.GetObject("ClassEditor.EmptyBraces");
Image currentImage = openBrace;
foreach (IParameter param in method.Parameters)
{
ParameterNode parameter = new ParameterNode(method, param, GetAmbience(), currentImage, this);
currentImage = comma;
item.Nodes.Add(parameter);
}
if (currentImage == openBrace)
currentImage = emptyBraces;
else
currentImage = closeBrace;
AddParameterNode addParam = new AddParameterNode(currentImage);
item.Nodes.Add(addParam);
addParameterItems[method] = addParam;
}
protected IAmbience GetAmbience()
{
IAmbience ambience = AmbienceService.GetCurrentAmbience();
ambience.ConversionFlags = ConversionFlags.None;
return ambience;
}
private static TextEditorControl GetTextEditorControl()
{
ITextEditorControlProvider textEditorProvider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorControlProvider;
if (textEditorProvider != null)
return textEditorProvider.TextEditorControl;
else
return null;
}
void _modifiersEditorShowing(object sender, CancelEventArgs e)
{
MemberNode memberItem = membersList.SelectedNode.Tag as MemberNode;
ParameterNode parameterItem = membersList.SelectedNode.Tag as ParameterNode;
if (memberItem != null)
{
_modifiers.DropDownItems.Clear();
_modifiers.DropDownItems.Add(ICSharpCode.NRefactory.Ast.Modifiers.Public);
_modifiers.DropDownItems.Add(ICSharpCode.NRefactory.Ast.Modifiers.Private);
_modifiers.DropDownItems.Add(ICSharpCode.NRefactory.Ast.Modifiers.Protected);
_modifiers.DropDownItems.Add(ICSharpCode.NRefactory.Ast.Modifiers.Internal);
}
else if (parameterItem != null)
{
_modifiers.DropDownItems.Clear();
_modifiers.DropDownItems.Add(ParameterModifiers.In);
_modifiers.DropDownItems.Add(ParameterModifiers.Out);
_modifiers.DropDownItems.Add(ParameterModifiers.Ref);
_modifiers.DropDownItems.Add(ParameterModifiers.Params);
_modifiers.DropDownItems.Add(ParameterModifiers.Optional);
}
else
e.Cancel = true;
}
void MembersListNodeMouseDoubleClick(object sender, TreeNodeAdvMouseEventArgs e)
{
Node item = e.Node.Tag as Node;
if (item == null) return;
MemberNode memberItem = item as MemberNode;
ParameterNode paramItem = item as ParameterNode;
AddMemberNode addMemberItem = item as AddMemberNode;
AddParameterNode addParamItem = item as AddParameterNode;
if (addMemberItem != null)// && addMemberItems.ContainsValue(memberItem))
{
/* IAmbience ambience = GetAmbience();
item.SubItems.Add(ambience.Convert(VoidReturnType.Instance));
item.SubItems.Add(ModifierEnum.Public.ToString());
item.SubItems.Add("");
item.Text = "[method name]";
item.BeginEdit(0);*/
}
else if (addParamItem != null) //addParameterItems.ContainsValue(item))
{
}
else if (memberItem != null)
{
MemberActivated(this, new IMemberEventArgs(memberItem.Member));
}
else if (paramItem != null)
{
if (paramItem.Parameter != null && paramItem.Method != null)
ParameterActivated(this, new IParameterEventArgs(paramItem.Method, paramItem.Parameter));
}
}
void _nameDrawText(object sender, DrawEventArgs e)
{
if ((e.Node.Tag is GroupNode || e.Node.Tag is AddParameterNode || e.Node.Tag is AddMemberNode) && e.Node.IsSelected == false)
e.TextColor = Color.Gray;
}
}
public enum Modification { None, Name, Type, Modifier, Summary }
}

87
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ClassEditor.csproj

@ -1,87 +0,0 @@ @@ -1,87 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>ClassEditor</RootNamespace>
<AssemblyName>ClassEditor</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F5E059BB-96C2-4398-BED0-8598CD434173}</ProjectGuid>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\Debug\</OutputPath>
<Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>True</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\Release\</OutputPath>
<Optimize>True</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="ClassEditor.cs" />
<Compile Include="ClassEditor.Designer.cs">
<DependentUpon>ClassEditor.cs</DependentUpon>
</Compile>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="MemberEventArgs.cs" />
<Compile Include="ParameterEventArgs.cs" />
<Compile Include="MemberDataEditors.cs" />
<EmbeddedResource Include="ClassEditor.resx">
<DependentUpon>ClassEditor.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj">
<Project>{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}</Project>
<Name>ICSharpCode.TextEditor</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Libraries\NRefactory\Project\NRefactory.csproj">
<Project>{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}</Project>
<Name>NRefactory</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Libraries\TreeViewAdv\Aga.Controls\Aga.Controls.csproj">
<Project>{E73BB233-D88B-44A7-A98F-D71EE158381D}</Project>
<Name>Aga.Controls</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj">
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project>
<Name>ICSharpCode.SharpDevelop.Dom</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj">
<Project>{8035765F-D51F-4A0C-A746-2FD100E19419}</Project>
<Name>ICSharpCode.SharpDevelop.Widgets</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

120
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ClassEditor.resx

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

52
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/MemberDataEditors.cs

@ -1,52 +0,0 @@ @@ -1,52 +0,0 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 20/10/2006
* Time: 20:08
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Xml;
using System.Xml.XPath;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.TextEditor;
namespace ClassDiagram
{
internal class VisibilityModifiersEditor : ComboBox
{
public VisibilityModifiersEditor()
{
this.DropDownStyle = ComboBoxStyle.DropDownList;
Items.Add(ICSharpCode.NRefactory.Ast.Modifiers.Public);
Items.Add(ICSharpCode.NRefactory.Ast.Modifiers.Private);
Items.Add(ICSharpCode.NRefactory.Ast.Modifiers.Protected);
Items.Add(ICSharpCode.NRefactory.Ast.Modifiers.Internal);
}
}
internal class ParameterModifiersEditor : ComboBox
{
public ParameterModifiersEditor()
{
this.DropDownStyle = ComboBoxStyle.DropDownList;
Items.Add(ParameterModifiers.In);
Items.Add(ParameterModifiers.Out);
Items.Add(ParameterModifiers.Ref);
Items.Add(ParameterModifiers.Params);
Items.Add(ParameterModifiers.Optional);
}
}
}

73
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/MemberEventArgs.cs

@ -1,73 +0,0 @@ @@ -1,73 +0,0 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 20/10/2006
* Time: 20:08
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Xml;
using System.Xml.XPath;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.TextEditor;
namespace ClassDiagram
{
public class IMemberEventArgs : EventArgs
{
IMember member;
public IMemberEventArgs (IMember member)
{
this.member = member;
}
public IMember Member
{
get { return member; }
}
}
public class IMemberModificationEventArgs : IMemberEventArgs
{
Modification modification;
string newValue;
bool cancel = false;
public IMemberModificationEventArgs(IMember member, Modification modification, string newValue)
: base (member)
{
this.modification = modification;
this.newValue = newValue;
}
public Modification Modification
{
get { return modification; }
}
public string NewValue
{
get { return newValue; }
}
public bool Cancel
{
get { return cancel; }
set { cancel = value; }
}
}
}

79
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/ParameterEventArgs.cs

@ -1,79 +0,0 @@ @@ -1,79 +0,0 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 20/10/2006
* Time: 20:08
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.IO;
using System.Xml;
using System.Xml.XPath;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.TextEditor;
namespace ClassDiagram
{
public class IParameterEventArgs : EventArgs
{
IParameter parameter;
IMethod method;
public IParameterEventArgs (IMethod method, IParameter parameter)
{
this.method = method;
this.parameter = parameter;
}
public IParameter Parameter
{
get { return parameter; }
}
public IMethod Method
{
get { return method; }
}
}
public class IParameterModificationEventArgs : IParameterEventArgs
{
Modification modification;
string newValue;
bool cancel = false;
public IParameterModificationEventArgs(IMethod method, IParameter parameter, Modification modification, string newValue)
: base (method, parameter)
{
this.modification = modification;
this.newValue = newValue;
}
public Modification Modification
{
get { return modification; }
}
public string NewValue
{
get { return newValue; }
}
public bool Cancel
{
get { return cancel; }
set { cancel = value; }
}
}
}

BIN
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/closebrace.bmp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

BIN
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/comma.bmp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

BIN
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/emptybraces.bmp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

BIN
src/AddIns/DisplayBindings/ClassDiagram/ClassEditor/openbrace.bmp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 B

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

@ -1,24 +0,0 @@ @@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<AddIn name = "ClassWizard"
author = "Itai Bar-Haim"
url = ""
description = "Visually add new classes to the project.">
<Manifest>
<Identity name="ClassWizard" />
</Manifest>
<Runtime>
<Import assembly = "ClassWizard.dll"/>
</Runtime>
<Path name = "/SharpDevelop/Workbench/MainMenu/Project/ProjectAddMenu">
<Condition name = "ProjectActive" activeproject="*">
<MenuItem type = "Separator"/>
<MenuItem id = "NewClass"
label = "Class"
class = "ClassWizard.AddNewClassCommand"/>
</Condition>
</Path>
</AddIn>

91
src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/ClassWizard.csproj

@ -1,91 +0,0 @@ @@ -1,91 +0,0 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>ClassWizard</RootNamespace>
<AssemblyName>ClassWizard</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8C59E80D-C4E4-4F36-9AD8-47C40F6E58B4}</ProjectGuid>
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\ClassWizard\</OutputPath>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<IntermediateOutputPath>obj\Debug\</IntermediateOutputPath>
<Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>True</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<StartAction>Program</StartAction>
<StartProgram>..\..\..\..\..\bin\SharpDevelop.exe</StartProgram>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<IntermediateOutputPath>obj\Release\</IntermediateOutputPath>
<Optimize>True</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' ">
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<None Include="ClassWizard.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<EmbeddedResource Include="Resources\ClassesList.xfrm" />
<EmbeddedResource Include="Resources\AddClassForm.xfrm" />
<Compile Include="..\..\..\..\Main\GlobalAssemblyInfo.cs">
<Link>Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\AddClassForm.cs" />
<Compile Include="Src\AddNewClassCommand.cs" />
<Compile Include="Src\AddNewInterfaceCommand.cs" />
<Compile Include="Src\ClassesList.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj">
<Project>{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}</Project>
<Name>ICSharpCode.TextEditor</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Libraries\NRefactory\Project\NRefactory.csproj">
<Project>{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}</Project>
<Name>NRefactory</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj">
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project>
<Name>ICSharpCode.SharpDevelop.Dom</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

20
src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/Configuration/AssemblyInfo.cs

@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Itai Bar-Haim" email=""/>
// </file>
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("ClassWizard")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

215
src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/Resources/AddClassForm.xfrm

@ -1,215 +0,0 @@ @@ -1,215 +0,0 @@
<Components version="1.0">
<System.Windows.Forms.Form>
<Name value="AddClassForm" />
<MinimumSize value="365, 342" />
<ControlBox value="False" />
<Text value="Add New Class" />
<ClientSize value="{Width=357, Height=308}" />
<Controls>
<System.Windows.Forms.CheckBox>
<Name value="isSealedCheckBox" />
<Location value="232, 194" />
<Text value="Sealed" />
<TabIndex value="15" />
<Size value="61, 20" />
<UseVisualStyleBackColor value="True" />
<Anchor value="Bottom, Left" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.CheckBox>
<Name value="isStaticCheckBox" />
<Location value="165, 193" />
<Text value="Static" />
<TabIndex value="8" />
<Size value="61, 20" />
<UseVisualStyleBackColor value="True" />
<Anchor value="Bottom, Left" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.CheckBox>
<Name value="isAbstractCheckBox" />
<Location value="84, 193" />
<Text value="Abstract" />
<TabIndex value="7" />
<Size value="75, 20" />
<UseVisualStyleBackColor value="True" />
<Anchor value="Bottom, Left" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.ComboBox>
<Name value="namespaceComboBox" />
<Size value="261, 21" />
<TabIndex value="0" />
<Sorted value="True" />
<FormattingEnabled value="True" />
<Location value="84, 11" />
<Anchor value="Top, Left, Right" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label5" />
<Location value="8, 14" />
<Text value="Namespace:" />
<Size value="67, 13" />
<AutoSize value="True" />
<TabIndex value="14" />
</System.Windows.Forms.Label>
<System.Windows.Forms.CheckBox>
<Name value="isPartialCheckBox" />
<Location value="299, 193" />
<Text value="Partial" />
<TabIndex value="9" />
<Size value="61, 20" />
<UseVisualStyleBackColor value="True" />
<Anchor value="Bottom, Left" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.ComboBox>
<Name value="visibilityComboBox" />
<Size value="123, 21" />
<TabIndex value="6" />
<FormattingEnabled value="True" />
<DropDownStyle value="DropDownList" />
<Location value="84, 166" />
<Anchor value="Bottom, Left" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label4" />
<Location value="8, 169" />
<Text value="Visibility:" />
<Anchor value="Bottom, Left" />
<Size value="46, 13" />
<AutoSize value="True" />
<TabIndex value="11" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Button>
<Name value="selectInterfacesButton" />
<Location value="320, 141" />
<Text value="..." />
<Anchor value="Bottom, Right" />
<UseVisualStyleBackColor value="True" />
<Size value="25, 19" />
<TabIndex value="5" />
</System.Windows.Forms.Button>
<System.Windows.Forms.ListBox>
<Name value="implementedInterfacesListBox" />
<Size value="230, 69" />
<TabIndex value="4" />
<HorizontalScrollbar value="True" />
<FormattingEnabled value="True" />
<Location value="84, 90" />
<Anchor value="Top, Bottom, Left, Right" />
</System.Windows.Forms.ListBox>
<System.Windows.Forms.Button>
<Name value="selectClassButton" />
<Location value="319, 64" />
<Text value="..." />
<Anchor value="Top, Right" />
<UseVisualStyleBackColor value="True" />
<Size value="25, 19" />
<TabIndex value="3" />
</System.Windows.Forms.Button>
<System.Windows.Forms.TextBox>
<Name value="inheritFromTextBox" />
<TabIndex value="2" />
<Size value="230, 20" />
<Location value="84, 64" />
<Anchor value="Top, Left, Right" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Button>
<Name value="browseButton" />
<Location value="320, 221" />
<Text value="..." />
<Anchor value="Bottom, Right" />
<UseVisualStyleBackColor value="True" />
<Size value="25, 19" />
<TabIndex value="11" />
</System.Windows.Forms.Button>
<System.Windows.Forms.ComboBox>
<Name value="existingFilesComboBox" />
<Size value="214, 21" />
<TabIndex value="12" />
<Sorted value="True" />
<FormattingEnabled value="True" />
<DropDownStyle value="DropDownList" />
<Location value="131, 246" />
<Anchor value="Bottom, Left, Right" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.RadioButton>
<Name value="addToFileRadioButton" />
<Location value="8, 247" />
<Text value="Add to existing file:" />
<Anchor value="Bottom, Left" />
<UseVisualStyleBackColor value="True" />
<Size value="113, 17" />
<AutoSize value="True" />
<TabIndex value="10" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.TextBox>
<Name value="newFileNameTextBox" />
<TabIndex value="10" />
<Size value="183, 20" />
<Location value="131, 220" />
<Anchor value="Bottom, Left, Right" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.RadioButton>
<Name value="createNewFileRadioButton" />
<TabStop value="True" />
<Location value="8, 221" />
<Checked value="True" />
<Text value="Create in new file:" />
<Anchor value="Bottom, Left" />
<UseVisualStyleBackColor value="True" />
<Size value="109, 17" />
<AutoSize value="True" />
<TabIndex value="8" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.Button>
<Name value="cancelButton" />
<DialogResult value="Cancel" />
<Location value="270, 273" />
<Text value="Cancel" />
<Anchor value="Bottom, Right" />
<UseVisualStyleBackColor value="True" />
<Size value="75, 23" />
<TabIndex value="14" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="okButton" />
<DialogResult value="OK" />
<Location value="189, 273" />
<Text value="OK" />
<Anchor value="Bottom, Right" />
<UseVisualStyleBackColor value="True" />
<Size value="75, 23" />
<TabIndex value="13" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Label>
<Name value="label3" />
<Location value="8, 90" />
<Text value="Implements:" />
<Size value="63, 13" />
<AutoSize value="True" />
<TabIndex value="5" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Label>
<Name value="label2" />
<Location value="8, 67" />
<Text value="Inherit from:" />
<Size value="62, 13" />
<AutoSize value="True" />
<TabIndex value="3" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Label>
<Name value="label1" />
<Location value="8, 41" />
<Text value="Class Name:" />
<Size value="66, 13" />
<AutoSize value="True" />
<TabIndex value="1" />
</System.Windows.Forms.Label>
<System.Windows.Forms.TextBox>
<Name value="classNameTextBox" />
<TabIndex value="1" />
<Size value="261, 20" />
<Location value="84, 38" />
<Anchor value="Top, Left, Right" />
</System.Windows.Forms.TextBox>
</Controls>
</System.Windows.Forms.Form>
</Components>

39
src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/Resources/ClassesList.xfrm

@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
<Components version="1.0">
<System.Windows.Forms.Form>
<Name value="form1" />
<ControlBox value="False" />
<Text value="Select Class To Inherit" />
<ClientSize value="{Width=292, Height=266}" />
<Controls>
<System.Windows.Forms.Button>
<Name value="cancelButton" />
<DialogResult value="Cancel" />
<Location value="205, 231" />
<Text value="Cancel" />
<Anchor value="Bottom, Right" />
<UseVisualStyleBackColor value="True" />
<Size value="75, 23" />
<TabIndex value="15" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="okButton" />
<Enabled value="False" />
<DialogResult value="OK" />
<Location value="124, 231" />
<Text value="OK" />
<Anchor value="Bottom, Right" />
<UseVisualStyleBackColor value="True" />
<Size value="75, 23" />
<TabIndex value="14" />
</System.Windows.Forms.Button>
<System.Windows.Forms.TreeView>
<Name value="classesTreeView" />
<Size value="268, 213" />
<TabIndex value="13" />
<PathSeparator value="." />
<Location value="12, 12" />
<Anchor value="Top, Bottom, Left, Right" />
</System.Windows.Forms.TreeView>
</Controls>
</System.Windows.Forms.Form>
</Components>

189
src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/Src/AddClassForm.cs

@ -1,189 +0,0 @@ @@ -1,189 +0,0 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 12/22/2006
* Time: 3:34 PM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.IO;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Gui.XmlForms;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.NRefactory.Ast;
using ICSharpCode.SharpDevelop.Dom.Refactoring;
using ICSharpCode.SharpDevelop.Refactoring;
namespace ClassWizard
{
public class AddClassForm : BaseSharpDevelopForm
{
public AddClassForm()
{
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ClassWizard.Resources.AddClassForm.xfrm"));
Get<Button>("ok").Click += OkButtonClick;
Get<RadioButton>("createNewFile").CheckedChanged += FileCreationModeChanged;
Get<RadioButton>("addToFile").CheckedChanged += FileCreationModeChanged;
Get<Button>("selectClass").Click += SelectClassButtonClick;
Get<Button>("selectInterfaces").Click += SelectInterfacesButtonClick;
ComboBox visibility = Get<ComboBox>("visibility");
visibility.Items.Add("Public");
visibility.Items.Add("Private");
visibility.Items.Add("Protected");
visibility.Items.Add("Internal");
visibility.SelectedIndex = 0;
classes.ClassType = ICSharpCode.SharpDevelop.Dom.ClassType.Class;
classes.SelectMultiple = false;
interfaces.ClassType = ICSharpCode.SharpDevelop.Dom.ClassType.Interface;
interfaces.SelectMultiple = true;
}
private ClassesListDialog classes = new ClassesListDialog();
private ClassesListDialog interfaces = new ClassesListDialog();
protected override void OnShown(EventArgs e)
{
IProject proj = ProjectService.CurrentProject;
IProjectContent projCont = proj.CreateProjectContent();
classes.Project = proj;
interfaces.Project = proj;
ComboBox existingFiles = Get<ComboBox>("existingFiles");
existingFiles.Items.Clear();
foreach (ProjectItem projectItem in ProjectService.CurrentProject.Items)
{
if (projectItem.ItemType == ItemType.Compile)
existingFiles.Items.Add(FileUtility.GetRelativePath(proj.Directory, projectItem.FileName));
}
ComboBox namespaces = Get<ComboBox>("namespace");
namespaces.Items.Clear();
foreach (string nsn in projCont.NamespaceNames)
namespaces.Items.Add(nsn);
base.OnShown(e);
}
void OkButtonClick(object sender, EventArgs e)
{
IProject proj = ProjectService.CurrentProject;
NamespaceDeclaration domNS = new NamespaceDeclaration(Get<ComboBox>("namespace").Text);
domNS.AddChild(new UsingDeclaration("System"));
domNS.AddChild(new UsingDeclaration("System.Collections.Generic"));
Modifiers mods = Modifiers.None;
if (Get<CheckBox>("isStatic").Checked)
mods |= Modifiers.Static;
if (Get<CheckBox>("isAbstract").Checked)
mods |= Modifiers.Abstract;
if (Get<CheckBox>("isSealed").Checked)
mods |= Modifiers.Sealed;
if (Get<CheckBox>("isPartial").Checked)
mods |= Modifiers.Partial;
ComboBox visibility = Get<ComboBox>("visibility");
switch (visibility.SelectedIndex)
{
case 0: mods |= Modifiers.Public; break;
case 1: mods |= Modifiers.Private; break;
case 2: mods |= Modifiers.Protected; break;
case 3: mods |= Modifiers.Internal; break;
}
TypeDeclaration domType = new TypeDeclaration(mods, null);
domType.Name = Get<TextBox>("className").Text;
domType.Type = ICSharpCode.NRefactory.Ast.ClassType.Class;
ListBox ifacesList = Get<ListBox>("implementedInterfaces");
foreach (string c in ifacesList.Items)
domType.BaseTypes.Add(new TypeReference(c));
domNS.AddChild(domType);
if (Get<RadioButton>("createNewFile").Checked)
{
StreamWriter sw;
string filename = Get<TextBox>("newFileName").Text;
if (!Path.HasExtension(filename))
filename += "." + proj.LanguageProperties.CodeDomProvider.FileExtension;
filename = Path.Combine(proj.Directory, filename);
sw = File.CreateText(filename);
sw.Write(proj.LanguageProperties.CodeGenerator.GenerateCode(domNS, String.Empty));
sw.Close();
FileProjectItem fpi = new FileProjectItem(proj, ItemType.Compile);
fpi.FileName = filename;
ProjectService.AddProjectItem(proj, fpi);
ProjectBrowserPad.Instance.ProjectBrowserControl.RefreshView();
proj.Save();
}
else
{
string filename = Path.Combine(proj.Directory, Get<ComboBox>("existingFiles").Text);
IViewContent viewContent = FileService.OpenFile(filename);
proj.LanguageProperties.CodeGenerator.InsertCodeAtEnd(DomRegion.Empty, GetDocument(viewContent), new AbstractNode[] { domNS });
}
}
private static IDocument GetDocument(IViewContent viewContent)
{
ITextEditorControlProvider provider1 = viewContent as ITextEditorControlProvider;
if (provider1 == null)
{
return null;
}
return new TextEditorDocument (provider1.TextEditorControl.Document);
}
void SelectClassButtonClick(object sender, EventArgs e)
{
if (classes.ShowDialog())
{
Get<TextBox>("inheritFrom").Text = classes.SelectedClasses[0].FullyQualifiedName;
}
}
void SelectInterfacesButtonClick(object sender, EventArgs e)
{
if (interfaces.ShowDialog())
{
ListBox ifacesList = Get<ListBox>("implementedInterfaces");
foreach (IClass c in interfaces.SelectedClasses)
{
ifacesList.Items.Add(c.FullyQualifiedName);
}
}
}
void FileCreationModeChanged(object sender, EventArgs e)
{
bool createNewState = Get<RadioButton>("createNewFile").Checked;
bool addToFileState = Get<RadioButton>("addToFile").Checked;
Get<TextBox>("newFileName").Enabled = createNewState;
Get<Button>("browse").Enabled = createNewState;
Get<ComboBox>("existingFiles").Enabled = addToFileState;
}
}
}

34
src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/Src/AddNewClassCommand.cs

@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 12/22/2006
* Time: 5:34 PM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
namespace ClassWizard
{
/// <summary>
/// Description of AddNewClassCommand
/// </summary>
public class AddNewClassCommand : AbstractCommand
{
/// <summary>
/// Starts the command
/// </summary>
public override void Run()
{
using (AddClassForm form = new AddClassForm())
{
form.Owner = (Form) WorkbenchSingleton.Workbench;
form.ShowDialog(WorkbenchSingleton.MainWin32Window);
}
}
}
}

13
src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/Src/AddNewInterfaceCommand.cs

@ -1,13 +0,0 @@ @@ -1,13 +0,0 @@
namespace ClassWizard
{
using System;
using System.Collections.Generic;
using ICSharpCode.Core;
public class AddNewInterfaceCommand : AbstractCommand
{
public override void Run()
{
}
}
}

185
src/AddIns/DisplayBindings/ClassDiagram/ClassWizard/Src/ClassesList.cs

@ -1,185 +0,0 @@ @@ -1,185 +0,0 @@
/*
* Created by SharpDevelop.
* User: itai
* Date: 12/23/2006
* Time: 8:27 PM
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using ICSharpCode.SharpDevelop.Gui;
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Gui.XmlForms;
using ICSharpCode.SharpDevelop.Project;
namespace ClassWizard
{
public class ClassesListDialog
{
private class ClassesList : BaseSharpDevelopForm
{
IClass baseClass;
public ClassesList() : this (null) {}
public ClassesList(IClass baseClass)
{
this.baseClass = baseClass;
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ClassWizard.Resources.ClassesList.xfrm"));
treeView = Get<TreeView>("classes");
treeView.BeforeCheck += ClassesTreeViewBeforeCheck;
treeView.AfterCheck += ClassesTreeViewAfterCheck;
treeView.AfterSelect += ClassesTreeViewAfterCheck;
}
private TreeView treeView;
public void InitializeClasses(IProject project, ClassType ct)
{
IProjectContent pc = ParserService.GetProjectContent(project);
treeView.Nodes.Clear();
AddClasses (pc, ct, false);
foreach (IProjectContent rpc in pc.ReferencedContents)
AddClasses (rpc, ct, false);
}
void AddClasses (IProjectContent pc, ClassType ct, bool allowSealed)
{
if (pc.Classes == null) return;
foreach (IClass c in pc.Classes)
{
if (c.ClassType == ct && (!c.IsSealed || (c.IsSealed && allowSealed)))
{
if (baseClass == null || (baseClass != null && c.IsTypeInInheritanceTree(baseClass)))
{
TreeNode node = AddItemToTreeView(c.FullyQualifiedName);
if (node != null)
node.Tag = c;
}
}
}
}
TreeNode AddItemToTreeView (string item)
{
string[] path = item.Split(treeView.PathSeparator[0]);
TreeNodeCollection tnc = treeView.Nodes;
TreeNode ret = null;
foreach (string pathitem in path)
{
if (tnc != null)
{
TreeNode tn;
if (!tnc.ContainsKey(pathitem))
{
tn = tnc.Add(pathitem, pathitem);
ret = tn;
}
else
tn = tnc[pathitem];
if (tn == null)
{
MessageBox.Show("Treenode is null: " + pathitem + "\n" + item);
}
tnc = tn.Nodes;
}
}
return ret;
}
void ClassesTreeViewBeforeCheck (object sender, TreeViewCancelEventArgs e)
{
e.Cancel = (e.Node.Nodes != null && e.Node.Nodes.Count > 0);
}
void ClassesTreeViewAfterCheck (object sender, TreeViewEventArgs e)
{
IClass c = (IClass) e.Node.Tag;
if (SelectMultiple)
{
if (e.Node.Checked && !selectedItems.Contains(c))
selectedItems.Add(c);
else if (!e.Node.Checked && selectedItems.Contains(c))
selectedItems.Remove(c);
}
else
{
selectedItems.Clear();
if (treeView.SelectedNode.Nodes == null || treeView.SelectedNode.Nodes.Count == 0)
selectedItems.Add((IClass)treeView.SelectedNode.Tag);
}
Get<Button>("ok").Enabled = (selectedItems.Count > 0);
}
public bool SelectMultiple
{
get { return treeView.CheckBoxes; }
set { treeView.CheckBoxes = value; }
}
List<IClass> selectedItems = new List<IClass>();
public IList<IClass> SelectedClasses
{
get { return selectedItems; }
}
}
ClassesList classesList = new ClassesList();
ClassType classType;
IProject project;
bool initialized = false;
public ClassesListDialog() {}
public bool ShowDialog()
{
if (!initialized)
{
classesList.InitializeClasses(project, classType);
initialized = true;
}
classesList.ShowDialog(WorkbenchSingleton.MainWin32Window);
return classesList.DialogResult == DialogResult.OK;
}
public ClassType ClassType
{
get { return classType; }
set
{
initialized &= classType == value;
classType = value;
}
}
public IProject Project
{
get { return project; }
set
{
initialized &= project == value;
project = value;
}
}
public bool SelectMultiple
{
get { return classesList.SelectMultiple; }
set { classesList.SelectMultiple = value; }
}
public IList<IClass> SelectedClasses
{
get { return classesList.SelectedClasses; }
}
}
}

8
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs

@ -192,13 +192,7 @@ namespace ICSharpCode.FormsDesigner @@ -192,13 +192,7 @@ namespace ICSharpCode.FormsDesigner
if (formClass.Name != this.formClass.Name) {
LoggingService.Info("Renaming form to " + formClass.Name);
Dictionary<string, IDocument> providedFileDocuments = new Dictionary<string, IDocument>();
providedFileDocuments.Add(this.ViewContent.DesignerCodeFile.FileName, this.ViewContent.DesignerCodeFileDocument);
if (!this.ViewContent.PrimaryFile.Equals(this.ViewContent.DesignerCodeFile)) {
System.Diagnostics.Debug.Assert(!this.ViewContent.DesignerCodeFileDocument.Equals(this.ViewContent.PrimaryFileDocument));
providedFileDocuments.Add(this.ViewContent.PrimaryFileName, this.ViewContent.PrimaryFileDocument);
}
ICSharpCode.SharpDevelop.Refactoring.FindReferencesAndRenameHelper.RenameClass(this.formClass, formClass.Name, providedFileDocuments);
ICSharpCode.SharpDevelop.Refactoring.FindReferencesAndRenameHelper.RenameClass(this.formClass, formClass.Name);
this.ViewContent.DesignerCodeFile.MakeDirty();
this.ViewContent.PrimaryFile.MakeDirty();
Reparse();

40
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs

@ -27,7 +27,7 @@ using ICSharpCode.TextEditor.Util; @@ -27,7 +27,7 @@ using ICSharpCode.TextEditor.Util;
namespace ICSharpCode.FormsDesigner
{
public class FormsDesignerViewContent : AbstractViewContentHandlingLoadErrors, IClipboardHandler, IUndoHandler, IHasPropertyContainer, IContextHelpProvider, IToolsHost
public class FormsDesignerViewContent : AbstractViewContentHandlingLoadErrors, IClipboardHandler, IUndoHandler, IHasPropertyContainer, IContextHelpProvider, IToolsHost, IFileDocumentProvider
{
readonly Control pleaseWaitLabel = new Label() {Text=StringParser.Parse("${res:Global.PleaseWait}"), TextAlign=ContentAlignment.MiddleCenter};
DesignSurface designSurface;
@ -39,6 +39,7 @@ namespace ICSharpCode.FormsDesigner @@ -39,6 +39,7 @@ namespace ICSharpCode.FormsDesigner
readonly IDesignerGenerator generator;
readonly ResourceStore resourceStore;
FormsDesignerUndoEngine undoEngine;
TypeResolutionService typeResolutionService;
Encoding primaryFileEncoding;
readonly IDocument primaryFileDocument = new DocumentFactory().CreateDocument();
@ -92,6 +93,17 @@ namespace ICSharpCode.FormsDesigner @@ -92,6 +93,17 @@ namespace ICSharpCode.FormsDesigner
get { return this.designerCodeFileEncoding; }
}
public IDocument GetDocumentForFile(OpenedFile file)
{
if (file == this.DesignerCodeFile) {
return this.DesignerCodeFileDocument;
} else if (file == this.PrimaryFile) {
return this.PrimaryFileDocument;
} else {
return null;
}
}
public IViewContent PrimaryViewContent {
get { return this.primaryViewContent; }
}
@ -254,7 +266,8 @@ namespace ICSharpCode.FormsDesigner @@ -254,7 +266,8 @@ namespace ICSharpCode.FormsDesigner
serviceContainer.AddService(typeof(System.ComponentModel.Design.IResourceService), new DesignerResourceService(this.resourceStore));
AmbientProperties ambientProperties = new AmbientProperties();
serviceContainer.AddService(typeof(AmbientProperties), ambientProperties);
serviceContainer.AddService(typeof(ITypeResolutionService), new TypeResolutionService(this.PrimaryFileName));
this.typeResolutionService = new TypeResolutionService(this.PrimaryFileName);
serviceContainer.AddService(typeof(ITypeResolutionService), this.typeResolutionService);
serviceContainer.AddService(typeof(DesignerOptionService), new SharpDevelopDesignerOptionService());
serviceContainer.AddService(typeof(ITypeDiscoveryService), new TypeDiscoveryService());
serviceContainer.AddService(typeof(MemberRelationshipService), new DefaultMemberRelationshipService());
@ -385,6 +398,7 @@ namespace ICSharpCode.FormsDesigner @@ -385,6 +398,7 @@ namespace ICSharpCode.FormsDesigner
designSurface = null;
}
this.typeResolutionService = null;
this.loader = null;
foreach (KeyValuePair<Type, TypeDescriptionProvider> entry in this.addedTypeDescriptionProviders) {
@ -557,8 +571,30 @@ namespace ICSharpCode.FormsDesigner @@ -557,8 +571,30 @@ namespace ICSharpCode.FormsDesigner
void IsActiveViewContentChangedHandler(object sender, EventArgs e)
{
if (this.IsActiveViewContent) {
LoggingService.Debug("FormsDesigner view content activated, setting ActiveDesignSurface to " + ((this.DesignSurface == null) ? "null" : this.DesignSurface.ToString()));
designSurfaceManager.ActiveDesignSurface = this.DesignSurface;
if (this.DesignSurface != null && this.Host != null) {
// Reload designer when a referenced assembly has changed
// (the default Load/Save logic using OpenedFile cannot catch this case)
if (this.typeResolutionService.ReferencedAssemblyChanged) {
IDesignerLoaderService loaderService = this.DesignSurface.GetService(typeof(IDesignerLoaderService)) as IDesignerLoaderService;
if (loaderService != null) {
if (!this.Host.Loading) {
LoggingService.Info("Forms designer reloading due to change in referenced assembly");
if (!loaderService.Reload()) {
MessageService.ShowMessage("The designer has detected that a referenced assembly has been changed, but the designer loader did not accept the reload command. Please reload the designer manually by closing and reopening this file.");
}
} else {
LoggingService.Debug("Forms designer detected change in referenced assembly, but is in load operation");
}
} else {
MessageService.ShowMessage("The designer has detected that a referenced assembly has been changed, but it cannot reload itself because IDesignerLoaderService is unavailable. Please reload the designer manually by closing and reopening this file.");
}
}
}
} else {
LoggingService.Debug("FormsDesigner view content deactivated, setting ActiveDesignSurface to null");
designSurfaceManager.ActiveDesignSurface = null;

18
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/CustomComponentsSideTab.cs

@ -88,8 +88,9 @@ namespace ICSharpCode.FormsDesigner.Gui @@ -88,8 +88,9 @@ namespace ICSharpCode.FormsDesigner.Gui
continue;
}
foreach (IClass c in pc.Classes) {
if (!c.Methods.Any(
(IMethod method) => method.IsConstructor && method.IsPublic && method.Parameters.Count == 0
var ctors = c.Methods.Where(method => method.IsConstructor);
if (ctors.Any() && !ctors.Any(
(IMethod method) => method.IsPublic && method.Parameters.Count == 0
)) {
// do not include classes that don't have a public parameterless constructor
continue;
@ -137,11 +138,16 @@ namespace ICSharpCode.FormsDesigner.Gui @@ -137,11 +138,16 @@ namespace ICSharpCode.FormsDesigner.Gui
this.IsTransient = true;
}
void Init()
void Init(IDesignerHost host)
{
LoggingService.Debug("Initializing MyToolBoxItem: " + className);
if (host == null) throw new ArgumentNullException("host");
if (assemblyLocation != null) {
Assembly asm = TypeResolutionService.LoadAssembly(assemblyLocation);
TypeResolutionService typeResolutionService = host.GetService(typeof(ITypeResolutionService)) as TypeResolutionService;
if (typeResolutionService == null) {
throw new InvalidOperationException("Cannot initialize CustomComponentToolBoxItem because the designer host does not provide a SharpDevelop TypeResolutionService.");
}
Assembly asm = typeResolutionService.LoadAssembly(assemblyLocation);
if (asm != null && usedAssembly != asm) {
Initialize(asm.GetType(className));
usedAssembly = asm;
@ -151,13 +157,13 @@ namespace ICSharpCode.FormsDesigner.Gui @@ -151,13 +157,13 @@ namespace ICSharpCode.FormsDesigner.Gui
protected override IComponent[] CreateComponentsCore(IDesignerHost host)
{
Init();
Init(host);
return base.CreateComponentsCore(host);
}
protected override IComponent[] CreateComponentsCore(IDesignerHost host, System.Collections.IDictionary defaultValues)
{
Init();
Init(host);
return base.CreateComponentsCore(host, defaultValues);
}
}

63
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/TypeResolutionService.cs

@ -10,6 +10,7 @@ using System.Collections.Generic; @@ -10,6 +10,7 @@ using System.Collections.Generic;
using System.ComponentModel.Design;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using ICSharpCode.Core;
@ -78,6 +79,11 @@ namespace ICSharpCode.FormsDesigner.Services @@ -78,6 +79,11 @@ namespace ICSharpCode.FormsDesigner.Services
string formSourceFileName;
IProjectContent callingProject;
/// <summary>
/// Dictionary of file name -> hash of loaded assemblies for the currently designed document.
/// Used to detect changes in references assemblies.
/// </summary>
readonly Dictionary<string, string> loadedAssembliesForCurrentDocument = new Dictionary<string, string>(StringComparer.Ordinal);
/// <summary>
/// Gets the project content of the project that created this TypeResolutionService.
@ -112,7 +118,7 @@ namespace ICSharpCode.FormsDesigner.Services @@ -112,7 +118,7 @@ namespace ICSharpCode.FormsDesigner.Services
/// <summary>
/// Loads the assembly represented by the project content. Returns null on failure.
/// </summary>
public static Assembly LoadAssembly(IProjectContent pc)
public Assembly LoadAssembly(IProjectContent pc)
{
// prevent StackOverflow when project contents have cyclic dependencies
// Very popular example of cyclic dependency: System <-> System.Xml (yes, really!)
@ -156,10 +162,24 @@ namespace ICSharpCode.FormsDesigner.Services @@ -156,10 +162,24 @@ namespace ICSharpCode.FormsDesigner.Services
return Path.GetFileName(fileName).ToLowerInvariant() + File.GetLastWriteTimeUtc(fileName).Ticks.ToString();
}
static string GetOriginalAssemblyFullPath(Assembly asm)
{
if (asm == null) throw new ArgumentNullException("asm");
try {
return new Uri(asm.CodeBase, UriKind.Absolute).LocalPath;
} catch (UriFormatException ex) {
LoggingService.Warn("Could not determine path for assembly '" + asm.ToString() + "', CodeBase='" + asm.CodeBase + "': " + ex.Message);
return asm.Location;
} catch (InvalidOperationException ex) {
LoggingService.Warn("Could not determine path for assembly '" + asm.ToString() + "', CodeBase='" + asm.CodeBase + "': " + ex.Message);
return asm.Location;
}
}
/// <summary>
/// Loads the file in none-locking mode. Returns null on failure.
/// </summary>
public static Assembly LoadAssembly(string fileName)
public Assembly LoadAssembly(string fileName)
{
if (!File.Exists(fileName))
return null;
@ -167,7 +187,7 @@ namespace ICSharpCode.FormsDesigner.Services @@ -167,7 +187,7 @@ namespace ICSharpCode.FormsDesigner.Services
// FIX for SD2-716, remove when designer gets its own AppDomain
foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) {
try {
if (string.Equals(asm.Location, fileName, StringComparison.InvariantCultureIgnoreCase)) {
if (string.Equals(GetOriginalAssemblyFullPath(asm), fileName, StringComparison.OrdinalIgnoreCase)) {
RegisterAssembly(asm);
return asm;
}
@ -257,17 +277,24 @@ namespace ICSharpCode.FormsDesigner.Services @@ -257,17 +277,24 @@ namespace ICSharpCode.FormsDesigner.Services
if (!designerAssemblies.Contains(asm))
designerAssemblies.Insert(0, asm);
}
lock (this.loadedAssembliesForCurrentDocument) {
this.loadedAssembliesForCurrentDocument[fileName] = hash;
}
assemblyDict[hash] = asm;
return asm;
}
}
public static void RegisterAssembly(Assembly asm)
void RegisterAssembly(Assembly asm)
{
string file = asm.Location;
if (file.Length > 0) {
string file = GetOriginalAssemblyFullPath(asm);
if (!String.IsNullOrEmpty(file)) {
string hash = GetHash(file);
lock (assemblyDict) {
assemblyDict[GetHash(file)] = asm;
assemblyDict[hash] = asm;
}
lock (this.loadedAssembliesForCurrentDocument) {
this.loadedAssembliesForCurrentDocument[file] = hash;
}
}
lock (designerAssemblies) {
@ -286,7 +313,7 @@ namespace ICSharpCode.FormsDesigner.Services @@ -286,7 +313,7 @@ namespace ICSharpCode.FormsDesigner.Services
return LoadAssembly(name, throwOnError);
}
static Assembly LoadAssembly(AssemblyName name, bool throwOnError)
Assembly LoadAssembly(AssemblyName name, bool throwOnError)
{
try {
Assembly asm = Assembly.Load(name);
@ -303,7 +330,7 @@ namespace ICSharpCode.FormsDesigner.Services @@ -303,7 +330,7 @@ namespace ICSharpCode.FormsDesigner.Services
{
Assembly assembly = GetAssembly(name);
if (assembly != null) {
return assembly.Location;
return GetOriginalAssemblyFullPath(assembly);
}
return null;
}
@ -370,6 +397,12 @@ namespace ICSharpCode.FormsDesigner.Services @@ -370,6 +397,12 @@ namespace ICSharpCode.FormsDesigner.Services
LoggingService.Error(e);
}
if (assembly != null) {
string fileName = GetOriginalAssemblyFullPath(assembly);
if (!String.IsNullOrEmpty(fileName)) {
lock (this.loadedAssembliesForCurrentDocument) {
this.loadedAssembliesForCurrentDocument[fileName] = GetHash(fileName);
}
}
lock (designerAssemblies) {
if (!designerAssemblies.Contains(assembly))
designerAssemblies.Add(assembly);
@ -407,6 +440,18 @@ namespace ICSharpCode.FormsDesigner.Services @@ -407,6 +440,18 @@ namespace ICSharpCode.FormsDesigner.Services
ICSharpCode.Core.LoggingService.Warn("TODO: Add Assembly reference : " + name);
}
/// <summary>
/// Gets whether an assembly referenced by the currently designed document
/// has been changed since it has been loaded.
/// </summary>
public bool ReferencedAssemblyChanged {
get {
return this.loadedAssembliesForCurrentDocument.Any(
pair => !File.Exists(pair.Key) || !String.Equals(pair.Value, GetHash(pair.Key), StringComparison.Ordinal)
);
}
}
#region VSDesigner workarounds
/// <summary>
/// HACK - Ignore any requests for types from the Microsoft.VSDesigner

16
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Configuration/AssemblyInfo.cs

@ -1,16 +0,0 @@ @@ -1,16 +0,0 @@
#region Using directives
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
#endregion
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WpfDesign.AddIn")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

112
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/AbstractEventHandlerService.cs

@ -1,112 +0,0 @@ @@ -1,112 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision: 2667$</version>
// </file>
using System;
using System.ComponentModel;
using System.IO;
using System.Windows.Controls;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.WpfDesign.AddIn
{
abstract class AbstractEventHandlerService : IEventHandlerService
{
WpfViewContent viewContent;
protected AbstractEventHandlerService(WpfViewContent viewContent)
{
if (viewContent == null)
throw new ArgumentNullException("viewContent");
this.viewContent = viewContent;
}
protected IProjectContent GetProjectContent()
{
IProject p = ProjectService.OpenSolution.FindProjectContainingFile(viewContent.PrimaryFileName);
if (p != null)
return ParserService.GetProjectContent(p) ?? ParserService.DefaultProjectContent;
else
return ParserService.DefaultProjectContent;
}
protected IClass GetDesignedClass()
{
Designer.Xaml.XamlDesignContext xamlContext = viewContent.DesignContext as Designer.Xaml.XamlDesignContext;
if (xamlContext != null) {
string className = xamlContext.ClassName;
if (!string.IsNullOrEmpty(className)) {
return GetProjectContent().GetClass(className, 0);
}
}
return null;
}
protected IClass GetDesignedClassCodeBehindPart(IClass c)
{
CompoundClass compound = c as CompoundClass;
if (compound != null) {
c = null;
foreach (IClass part in compound.Parts) {
if (string.IsNullOrEmpty(part.CompilationUnit.FileName))
continue;
if (".xaml".Equals(Path.GetExtension(part.CompilationUnit.FileName), StringComparison.OrdinalIgnoreCase))
continue;
if (c == null || c.CompilationUnit.FileName.Length > part.CompilationUnit.FileName.Length)
c = part;
}
}
return c;
}
protected abstract void CreateEventHandlerInternal(Type eventHandlerType, string handlerName);
public void CreateEventHandler(DesignItemProperty eventProperty)
{
var item = eventProperty.DesignItem;
string handlerName = (string)eventProperty.ValueOnInstance;
if (string.IsNullOrEmpty(handlerName)) {
if (string.IsNullOrEmpty(item.Name)) {
GenerateName(eventProperty.DesignItem);
}
handlerName = item.Name + "_" + eventProperty.Name;
eventProperty.SetValue(handlerName);
}
CreateEventHandlerInternal(eventProperty.ReturnType, handlerName);
}
public DesignItemProperty GetDefaultEvent(DesignItem item)
{
object[] attributes = item.ComponentType.GetCustomAttributes(typeof(DefaultEventAttribute), true);
if (attributes.Length == 1) {
DefaultEventAttribute dae = (DefaultEventAttribute)attributes[0];
DesignItemProperty property = item.Properties.GetProperty(dae.Name);
if (property != null && property.IsEvent) {
return property;
}
}
return null;
}
void GenerateName(DesignItem item)
{
for (int i = 1;; i++) {
try {
string name = item.ComponentType.Name + i;
name = char.ToLower(name[0]) + name.Substring(1);
item.Name = name;
break;
} catch {
}
}
}
}
}

47
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/CSharpEventHandlerService.cs

@ -1,47 +0,0 @@ @@ -1,47 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision: 2667$</version>
// </file>
using System;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
namespace ICSharpCode.WpfDesign.AddIn
{
sealed class CSharpEventHandlerService : AbstractEventHandlerService
{
public CSharpEventHandlerService(WpfViewContent viewContent) : base(viewContent)
{
}
protected override void CreateEventHandlerInternal(Type eventHandlerType, string handlerName)
{
IClass c = GetDesignedClass();
if (c != null) {
foreach (IMethod m in c.Methods) {
if (m.Name == handlerName) {
FileService.JumpToFilePosition(m.DeclaringType.CompilationUnit.FileName,
m.Region.BeginLine - 1, m.Region.BeginColumn - 1);
return;
}
}
}
c = GetDesignedClassCodeBehindPart(c);
if (c != null) {
ITextEditorControlProvider tecp = FileService.OpenFile(c.CompilationUnit.FileName) as ITextEditorControlProvider;
if (tecp != null) {
int lineNumber;
FormsDesigner.CSharpDesignerGenerator.CreateComponentEvent(
c, tecp.TextEditorControl.Document, eventHandlerType, handlerName, null,
out lineNumber);
tecp.TextEditorControl.ActiveTextAreaControl.JumpTo(lineNumber - 1);
}
}
}
}
}

39
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/FileUriContext.cs

@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using System;
using System.IO;
using System.Windows.Markup;
using ICSharpCode.SharpDevelop;
namespace ICSharpCode.WpfDesign.AddIn
{
/// <summary>
/// Used to support loading Image.ImageSource.
/// </summary>
public class FileUriContext : IUriContext
{
OpenedFile file;
public FileUriContext(OpenedFile file)
{
if (file == null)
throw new ArgumentNullException("file");
this.file = file;
}
public Uri BaseUri {
get {
return new Uri(file.FileName);
}
set {
throw new NotSupportedException();
}
}
}
}

49
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/IdeChooseClassService.cs

@ -1,49 +0,0 @@ @@ -1,49 +0,0 @@
using System;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using System.Reflection;
using System.Collections.Generic;
using System.IO;
using ICSharpCode.Core;
using ICSharpCode.WpfDesign.Designer.Services;
namespace ICSharpCode.WpfDesign.AddIn
{
//TODO
public class IdeChooseClassService : ChooseClassServiceBase
{
static string GetAssemblyPath(IProjectContent projectContent)
{
var r = projectContent as ReflectionProjectContent;
if (r != null) {
return r.AssemblyLocation;
}
var p = projectContent.Project as IProject;
if (p != null) {
return p.OutputAssemblyFullPath;
}
return null;
}
static Assembly GetAssembly(IProjectContent projectContent)
{
var path = GetAssemblyPath(projectContent);
if (path != null && File.Exists(path)) {
return Assembly.LoadFile(path);
}
return null;
}
public override IEnumerable<Assembly> GetAssemblies()
{
var pc = ParserService.CurrentProjectContent;
var a = GetAssembly(pc);
if (a != null) yield return a;
foreach (var r in pc.ReferencedContents) {
a = GetAssembly(r);
if (a != null) yield return a;
}
}
}
}

62
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/MyTypeFinder.cs

@ -1,62 +0,0 @@ @@ -1,62 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Reflection;
using ICSharpCode.WpfDesign.XamlDom;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Project;
using TypeResolutionService = ICSharpCode.FormsDesigner.Services.TypeResolutionService;
namespace ICSharpCode.WpfDesign.AddIn
{
public class MyTypeFinder : XamlTypeFinder
{
OpenedFile file;
public static MyTypeFinder Create(OpenedFile file)
{
MyTypeFinder f = new MyTypeFinder();
f.file = file;
f.ImportFrom(CreateWpfTypeFinder());
return f;
}
public override Assembly LoadAssembly(string name)
{
if (string.IsNullOrEmpty(name)) {
IProjectContent pc = GetProjectContent(file);
if (pc != null) {
return TypeResolutionService.LoadAssembly(pc);
}
return null;
} else {
return base.LoadAssembly(name);
}
}
public override XamlTypeFinder Clone()
{
MyTypeFinder copy = new MyTypeFinder();
copy.file = this.file;
copy.ImportFrom(this);
return copy;
}
internal static IProjectContent GetProjectContent(OpenedFile file)
{
if (ProjectService.OpenSolution != null && file != null) {
IProject p = ProjectService.OpenSolution.FindProjectContainingFile(file.FileName);
if (p != null) {
return ParserService.GetProjectContent(p);
}
}
return ParserService.DefaultProjectContent;
}
}
}

8
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ObjectEditor.xaml

@ -1,8 +0,0 @@ @@ -1,8 +0,0 @@
<Button
x:Class="ICSharpCode.WpfDesign.AddIn.ObjectEditor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Content="New..."
HorizontalAlignment="Right"
>
</Button>

31
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/ObjectEditor.xaml.cs

@ -1,31 +0,0 @@ @@ -1,31 +0,0 @@
using System;
using System.Windows;
using ICSharpCode.WpfDesign.PropertyGrid;
using ICSharpCode.WpfDesign.Designer.Services;
namespace ICSharpCode.WpfDesign.AddIn
{
[PropertyEditor(typeof(FrameworkElement), "DataContext")]
public partial class ObjectEditor
{
public ObjectEditor()
{
InitializeComponent();
}
public PropertyNode PropertyNode {
get { return DataContext as PropertyNode; }
}
protected override void OnClick()
{
var s = PropertyNode.Services.GetService<ChooseClassServiceBase>();
if (s != null) {
var c = s.ChooseClass();
if (c != null) {
PropertyNode.Value = Activator.CreateInstance(c);
}
}
}
}
}

47
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/OutlineViewPad.cs

@ -1,47 +0,0 @@ @@ -1,47 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Windows;
using System.Windows.Controls;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.WpfDesign.AddIn
{
public class OutlineViewPad : AbstractPadContent
{
ContentControl host = new ContentControl();
TextBlock notAvailableTextBlock = new TextBlock {
Text = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Gui.OutlinePad.NotAvailable}"),
TextWrapping = TextWrapping.Wrap
};
public OutlineViewPad()
{
WorkbenchSingleton.Workbench.ActiveViewContentChanged += WorkbenchActiveViewContentChanged;
WorkbenchActiveViewContentChanged(null, null);
}
void WorkbenchActiveViewContentChanged(object sender, EventArgs e)
{
WpfViewContent wpfView = WorkbenchSingleton.Workbench.ActiveViewContent as WpfViewContent;
if (wpfView != null) {
host.Content = wpfView.Outline;
} else {
host.Content = notAvailableTextBlock;
}
}
public override object Content {
get {
return host;
}
}
}
}

41
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/PropertyDescriptionService.cs

@ -1,41 +0,0 @@ @@ -1,41 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <author name="Daniel Grunwald"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
namespace ICSharpCode.WpfDesign.AddIn
{
public class PropertyDescriptionService : IPropertyDescriptionService
{
OpenedFile file;
public PropertyDescriptionService(OpenedFile file)
{
if (file == null)
throw new ArgumentNullException("file");
this.file = file;
}
public object GetDescription(DesignItemProperty property)
{
IProjectContent pc = MyTypeFinder.GetProjectContent(file);
if (pc != null) {
IClass c = pc.GetClassByReflectionName(property.DeclaringType.FullName, true);
if (c != null) {
IMember m = DefaultProjectContent.GetMemberByReflectionName(c, property.Name);
if (m != null)
return CodeCompletionData.GetDocumentation(m.Documentation);
}
}
return null;
}
}
}

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

Loading…
Cancel
Save