Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3623 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
430 changed files with 3511 additions and 28228 deletions
@ -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> |
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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> |
||||
|
After Width: | Height: | Size: 470 B |
|
After Width: | Height: | Size: 537 B |
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
using System.Windows; |
||||
|
||||
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] |
||||
@ -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; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -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)"><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></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)"><?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></Value> |
||||
</Setting> |
||||
<Setting Name="MainWindowState" Type="System.Windows.WindowState" Scope="User"> |
||||
<Value Profile="(Default)">Maximized</Value> |
||||
</Setting> |
||||
</Settings> |
||||
</SettingsFile> |
||||
@ -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> |
||||
@ -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> |
||||
@ -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); |
||||
} |
||||
} |
||||
} |
||||
@ -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><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></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> |
||||
@ -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); |
||||
} |
||||
} |
||||
} |
||||
@ -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>"; |
||||
} |
||||
} |
||||
} |
||||
@ -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("")] |
||||
@ -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; } |
||||
} |
||||
} |
||||
} |
||||
@ -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); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -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); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -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(); |
||||
} |
||||
} |
||||
} |
||||
@ -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); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -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(); |
||||
} |
||||
} |
||||
} |
||||
@ -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; } |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -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> |
||||
@ -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> |
||||
@ -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("")] |
||||
@ -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> |
||||
@ -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); |
||||
} |
||||
} |
||||
} |
||||
@ -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; |
||||
} |
||||
} |
||||
} |
||||
@ -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("")] |
||||
@ -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; |
||||
} |
||||
} |
||||
@ -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 } |
||||
} |
||||
@ -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> |
||||
@ -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> |
||||
@ -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); |
||||
} |
||||
} |
||||
} |
||||
@ -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; } |
||||
} |
||||
} |
||||
|
||||
} |
||||
@ -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; } |
||||
} |
||||
} |
||||
} |
||||
|
Before Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 246 B |
|
Before Width: | Height: | Size: 246 B |
@ -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> |
||||
@ -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> |
||||
@ -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("")] |
||||
@ -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> |
||||
@ -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> |
||||
@ -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; |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -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); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -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() |
||||
{ |
||||
} |
||||
} |
||||
} |
||||
@ -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; } |
||||
} |
||||
} |
||||
} |
||||
@ -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("")] |
||||
@ -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 { |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -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); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -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(); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -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; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -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; |
||||
} |
||||
} |
||||
} |
||||
@ -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> |
||||
@ -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); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -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; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -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…
Reference in new issue