Browse Source

DefaultWorkbench can now be replaced with a custom class implementing the IWorkbench interface. Added a snippet compiler sample that demonstrates how the DefaultWorkbench can be replaced.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3096 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 17 years ago
parent
commit
954948bcbb
  1. 31
      samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/AssemblyInfo.cs
  2. 24
      samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/BuildSnippetCommand.cs
  3. 314
      samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/MainViewContent.cs
  4. 105
      samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/SharpSnippetCompiler.Core.csproj
  5. 48
      samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/SharpSnippetCompilerControl.Designer.cs
  6. 66
      samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/SharpSnippetCompilerControl.cs
  7. 120
      samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/SharpSnippetCompilerControl.resx
  8. 54
      samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/SharpSnippetCompilerManager.cs
  9. 136
      samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/SnippetCompilerProject.cs
  10. 40
      samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/SnippetFile.cs
  11. 197
      samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/Workbench.cs
  12. BIN
      samples/SharpSnippetCompiler/SharpSnippetCompiler.rtf
  13. 24
      samples/SharpSnippetCompiler/SharpSnippetCompiler.sln
  14. 31
      samples/SharpSnippetCompiler/SharpSnippetCompiler/AssemblyInfo.cs
  15. 458
      samples/SharpSnippetCompiler/SharpSnippetCompiler/MainForm.Designer.cs
  16. 370
      samples/SharpSnippetCompiler/SharpSnippetCompiler/MainForm.cs
  17. 123
      samples/SharpSnippetCompiler/SharpSnippetCompiler/MainForm.resx
  18. 117
      samples/SharpSnippetCompiler/SharpSnippetCompiler/NewFileDialog.Designer.cs
  19. 52
      samples/SharpSnippetCompiler/SharpSnippetCompiler/NewFileDialog.cs
  20. 120
      samples/SharpSnippetCompiler/SharpSnippetCompiler/NewFileDialog.resx
  21. 13
      samples/SharpSnippetCompiler/SharpSnippetCompiler/PreBuildEvent.proj
  22. 108
      samples/SharpSnippetCompiler/SharpSnippetCompiler/Program.cs
  23. 90
      samples/SharpSnippetCompiler/SharpSnippetCompiler/SharpSnippetCompiler.csproj
  24. 49
      samples/SharpSnippetCompiler/SharpSnippetCompiler/SnippetTabPage.cs
  25. 128
      samples/SharpSnippetCompiler/SharpSnippetCompiler/WorkbenchLayout.cs
  26. 146
      samples/SharpSnippetCompiler/SharpSnippetCompiler/WorkbenchWindow.cs
  27. 45
      samples/SharpSnippetCompiler/SharpSnippetCompiler/app.config
  28. 12
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockWorkbench.cs
  29. 18
      src/Main/Base/Project/Src/Gui/IWorkbench.cs
  30. 6
      src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs
  31. 28
      src/Main/Base/Project/Src/Gui/WorkbenchSingleton.cs

31
samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/AssemblyInfo.cs

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
#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("SharpSnippetCompiler.Core")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SharpSnippetCompiler.Core")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]

24
samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/BuildSnippetCommand.cs

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// </file>
using System;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Project.Commands;
namespace ICSharpCode.SharpSnippetCompiler.Core
{
public class BuildSnippetCommand : BuildProject
{
public BuildSnippetCommand(IProject project)
: base(project)
{
}
public override bool CanRunBuild {
get { return true; }
}
}
}

314
samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/MainViewContent.cs

@ -0,0 +1,314 @@ @@ -0,0 +1,314 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// </file>
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.TextEditor;
using ICSharpCode.TextEditor.Document;
namespace ICSharpCode.SharpSnippetCompiler.Core
{
public class MainViewContent : IViewContent, ITextEditorControlProvider, IClipboardHandler, IUndoHandler, IPositionable, IParseInformationListener, IEditable
{
IWorkbenchWindow workbenchWindow;
TextEditorControl textEditor;
SharpSnippetCompilerControl snippetControl;
SnippetFile file;
public MainViewContent(string fileName, SharpSnippetCompilerControl snippetControl, IWorkbenchWindow workbenchWindow)
{
file = new SnippetFile(fileName);
this.snippetControl = snippetControl;
this.textEditor = snippetControl.TextEditor;
this.workbenchWindow = workbenchWindow;
}
public event EventHandler TabPageTextChanged;
public event EventHandler TitleNameChanged;
public event EventHandler Disposed;
public event EventHandler IsDirtyChanged;
public bool EnableUndo {
get { return textEditor.EnableUndo; }
}
public bool EnableRedo {
get { return textEditor.EnableRedo; }
}
public void Undo()
{
textEditor.Undo();
}
public void Redo()
{
textEditor.Redo();
}
public bool EnableCut {
get { return textEditor.ActiveTextAreaControl.TextArea.ClipboardHandler.EnableCut; }
}
public bool EnableCopy {
get { return textEditor.ActiveTextAreaControl.TextArea.ClipboardHandler.EnableCopy; }
}
public bool EnablePaste {
get { return textEditor.ActiveTextAreaControl.TextArea.ClipboardHandler.EnablePaste; }
}
public bool EnableDelete {
get { return textEditor.ActiveTextAreaControl.TextArea.ClipboardHandler.EnableDelete; }
}
public bool EnableSelectAll {
get { return textEditor.ActiveTextAreaControl.TextArea.ClipboardHandler.EnableSelectAll; }
}
public void Cut()
{
textEditor.ActiveTextAreaControl.TextArea.ClipboardHandler.Cut(null, null);
}
public void Copy()
{
textEditor.ActiveTextAreaControl.TextArea.ClipboardHandler.Copy(null, null);
}
public void Paste()
{
textEditor.ActiveTextAreaControl.TextArea.ClipboardHandler.Paste(null, null);
}
public void Delete()
{
textEditor.ActiveTextAreaControl.TextArea.ClipboardHandler.Delete(null, null);
}
public void SelectAll()
{
textEditor.ActiveTextAreaControl.TextArea.ClipboardHandler.SelectAll(null, null);
}
public TextEditorControl TextEditorControl {
get { return textEditor; }
}
public Control Control {
get { return snippetControl; }
}
public IWorkbenchWindow WorkbenchWindow {
get { return workbenchWindow; }
set { workbenchWindow = value; }
}
public string TabPageText {
get {
throw new NotImplementedException();
}
}
public string TitleName {
get {
throw new NotImplementedException();
}
}
public IList<OpenedFile> Files {
get {
throw new NotImplementedException();
}
}
public OpenedFile PrimaryFile {
get { return file; }
}
public string PrimaryFileName {
get { return file.FileName; }
}
public bool IsDisposed {
get {
throw new NotImplementedException();
}
}
public bool IsReadOnly {
get {
throw new NotImplementedException();
}
}
public bool IsViewOnly {
get {
throw new NotImplementedException();
}
}
public ICollection<IViewContent> SecondaryViewContents {
get {
throw new NotImplementedException();
}
}
public bool IsDirty {
get {
throw new NotImplementedException();
}
}
public void RedrawContent()
{
throw new NotImplementedException();
}
public void Save(OpenedFile file, Stream stream)
{
throw new NotImplementedException();
}
public void Load(OpenedFile file, Stream stream)
{
throw new NotImplementedException();
}
public INavigationPoint BuildNavPoint()
{
throw new NotImplementedException();
}
public bool SupportsSwitchFromThisWithoutSaveLoad(OpenedFile file, IViewContent newView)
{
throw new NotImplementedException();
}
public bool SupportsSwitchToThisWithoutSaveLoad(OpenedFile file, IViewContent oldView)
{
throw new NotImplementedException();
}
public void SwitchFromThisWithoutSaveLoad(OpenedFile file, IViewContent newView)
{
throw new NotImplementedException();
}
public void SwitchToThisWithoutSaveLoad(OpenedFile file, IViewContent oldView)
{
throw new NotImplementedException();
}
public void Dispose()
{
}
public void JumpTo(int line, int column)
{
textEditor.ActiveTextAreaControl.JumpTo(line, column);
// // we need to delay this call here because the text editor does not know its height if it was just created
// WorkbenchSingleton.SafeThreadAsyncCall(
// delegate {
// textEditor.ActiveTextAreaControl.CenterViewOn(
// line, (int)(0.3 * textEditor.ActiveTextAreaControl.TextArea.TextView.VisibleLineCount));
// });
}
public int Line {
get { return textEditor.ActiveTextAreaControl.Caret.Line; }
}
public int Column {
get { return textEditor.ActiveTextAreaControl.Caret.Column; }
}
public void ParseInformationUpdated(ParseInformation parseInfo)
{
if (textEditor.TextEditorProperties.EnableFolding) {
WorkbenchSingleton.SafeThreadAsyncCall(ParseInformationUpdatedInvoked, parseInfo);
}
}
public delegate string GetTextHelper();
public string Text {
get {
if (WorkbenchSingleton.InvokeRequired) {
return (string)WorkbenchSingleton.MainForm.Invoke(new GetTextHelper(GetText));
//return WorkbenchSingleton.SafeThreadFunction<string>(GetText);
} else {
return GetText();
}
}
set {
if (WorkbenchSingleton.InvokeRequired) {
WorkbenchSingleton.SafeThreadCall(SetText, value);
} else {
SetText(value);
}
}
}
protected virtual void OnTabPageTextChanged(EventArgs e)
{
if (TabPageTextChanged != null) {
TabPageTextChanged(this, e);
}
}
protected virtual void OnTitleNameChanged(EventArgs e)
{
if (TitleNameChanged != null) {
TitleNameChanged(this, e);
}
}
protected virtual void OnDisposed(EventArgs e)
{
if (Disposed != null) {
Disposed(this, e);
}
}
protected virtual void OnIsDirtyChanged(EventArgs e)
{
if (IsDirtyChanged != null) {
IsDirtyChanged(this, e);
}
}
void ParseInformationUpdatedInvoked(ParseInformation parseInfo)
{
try {
textEditor.Document.FoldingManager.UpdateFoldings(file.FileName, parseInfo);
textEditor.ActiveTextAreaControl.TextArea.Refresh(textEditor.ActiveTextAreaControl.TextArea.FoldMargin);
textEditor.ActiveTextAreaControl.TextArea.Refresh(textEditor.ActiveTextAreaControl.TextArea.IconBarMargin);
} catch (Exception ex) {
MessageService.ShowError(ex);
}
}
string GetText()
{
return textEditor.Document.TextContent;
}
void SetText(string value)
{
textEditor.Document.Replace(0, textEditor.Document.TextLength, value);
}
}
}

105
samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/SharpSnippetCompiler.Core.csproj

@ -0,0 +1,105 @@ @@ -0,0 +1,105 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<ProjectGuid>{5A2EC8F7-2274-4EA3-AC7A-6D1C8598F938}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Library</OutputType>
<RootNamespace>ICSharpCode.SharpSnippetCompiler.Core</RootNamespace>
<AssemblyName>SharpSnippetCompiler.Core</AssemblyName>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>..\SharpSnippetCompiler\bin\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>..\SharpSnippetCompiler\bin\</OutputPath>
<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="Aga.Controls">
<HintPath>..\..\..\bin\Aga.Controls.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.Build.Tasks">
<HintPath>..\..\..\bin\ICSharpCode.Build.Tasks.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.Core">
<HintPath>..\..\..\bin\ICSharpCode.Core.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.NRefactory">
<HintPath>..\..\..\bin\ICSharpCode.NRefactory.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpDevelop">
<HintPath>..\..\..\bin\ICSharpCode.SharpDevelop.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpDevelop.Dom">
<HintPath>..\..\..\bin\ICSharpCode.SharpDevelop.Dom.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpDevelop.Sda">
<HintPath>..\..\..\bin\ICSharpCode.SharpDevelop.Sda.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.TextEditor">
<HintPath>..\..\..\bin\ICSharpCode.TextEditor.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\..\..\bin\log4net.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="BuildSnippetCommand.cs" />
<Compile Include="MainViewContent.cs" />
<Compile Include="SharpSnippetCompilerControl.cs" />
<Compile Include="SharpSnippetCompilerControl.Designer.cs">
<DependentUpon>SharpSnippetCompilerControl.cs</DependentUpon>
</Compile>
<Compile Include="SharpSnippetCompilerManager.cs" />
<Compile Include="SnippetCompilerProject.cs" />
<Compile Include="SnippetFile.cs" />
<Compile Include="Workbench.cs" />
<EmbeddedResource Include="..\..\..\src\Main\StartUp\Project\Resources\BitmapResources.resources">
<Link>Resources\BitmapResources.resources</Link>
<LogicalName>Resources.BitmapResources.resources</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="..\..\..\src\Main\StartUp\Project\Resources\StringResources.resources">
<Link>Resources\StringResources.resources</Link>
<LogicalName>Resources.StringResources.resources</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="SharpSnippetCompilerControl.resx">
<DependentUpon>SharpSnippetCompilerControl.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Folder Include="Resources" />
</ItemGroup>
</Project>

48
samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/SharpSnippetCompilerControl.Designer.cs generated

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// </file>
namespace ICSharpCode.SharpSnippetCompiler.Core
{
partial class SharpSnippetCompilerControl
{
/// <summary>
/// Designer variable used to keep track of non-visual components.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Disposes resources used by the control.
/// </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.SuspendLayout();
//
// SharpSnippetCompilerControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "SharpSnippetCompilerControl";
this.Size = new System.Drawing.Size(491, 310);
this.ResumeLayout(false);
}
}
}

66
samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/SharpSnippetCompilerControl.cs

@ -0,0 +1,66 @@ @@ -0,0 +1,66 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// </file>
using System;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Debugging;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.TextEditor;
using ICSharpCode.TextEditor.Document;
namespace ICSharpCode.SharpSnippetCompiler.Core
{
public partial class SharpSnippetCompilerControl : UserControl
{
SharpDevelopTextAreaControl textEditor;
public SharpSnippetCompilerControl()
{
InitializeComponent();
textEditor = new SharpDevelopTextAreaControl();
textEditor.Dock = DockStyle.Fill;
this.Controls.Add(textEditor);
textEditor.ActiveTextAreaControl.TextArea.IconBarMargin.MouseDown += MarginMouseDown;
}
public TextEditorControl TextEditor {
get { return textEditor; }
}
public void LoadFile(string fileName)
{
textEditor.LoadFile(fileName);
}
public void Save()
{
textEditor.SaveFile(textEditor.FileName);
}
static void MarginMouseDown(AbstractMargin iconBar, Point mousepos, MouseButtons mouseButtons)
{
if (mouseButtons != MouseButtons.Left) return;
Rectangle viewRect = iconBar.TextArea.TextView.DrawingPosition;
TextLocation logicPos = iconBar.TextArea.TextView.GetLogicalPosition(0, mousepos.Y - viewRect.Top);
if (logicPos.Y >= 0 && logicPos.Y < iconBar.TextArea.Document.TotalNumberOfLines) {
DebuggerService.ToggleBreakpointAt(iconBar.TextArea.Document, iconBar.TextArea.MotherTextEditorControl.FileName, logicPos.Y);
iconBar.TextArea.Refresh(iconBar);
}
}
}
}

120
samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/SharpSnippetCompilerControl.resx

@ -0,0 +1,120 @@ @@ -0,0 +1,120 @@
<?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>

54
samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/SharpSnippetCompilerManager.cs

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
// <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.IO;
using System.Reflection;
using System.Resources;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Commands;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Sda;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SharpSnippetCompiler.Core
{
public sealed class SharpSnippetCompilerManager
{
SharpSnippetCompilerManager()
{
}
public static void Init()
{
SharpSnippetCompilerManager manager = new SharpSnippetCompilerManager();
Assembly exe = manager.GetType().Assembly;
string rootPath = Path.GetDirectoryName(exe.Location);
string configDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "SharpSnippetCompiler");
string dataDirectory = Path.Combine(rootPath, "data");
CoreStartup startup = new CoreStartup("SharpSnippetCompiler");
startup.ConfigDirectory = configDirectory;
startup.DataDirectory = dataDirectory;
startup.PropertiesName = "SharpSnippetCompiler";
startup.StartCoreServices();
ResourceService.RegisterNeutralStrings(new ResourceManager("Resources.StringResources", exe));
ResourceService.RegisterNeutralImages(new ResourceManager("Resources.BitmapResources", exe));
StringParser.RegisterStringTagProvider(new SharpDevelopStringTagProvider());
string addInFolder = Path.Combine(rootPath, "AddIns");
startup.AddAddInsFromDirectory(addInFolder);
startup.RunInitialization();
}
}
}

136
samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/SnippetCompilerProject.cs

@ -0,0 +1,136 @@ @@ -0,0 +1,136 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// </file>
using System;
using System.IO;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.SharpSnippetCompiler.Core
{
public class SnippetCompilerProject : CompilableProject
{
static readonly string DefaultSnippetSource = "using System;\r\n\r\n" +
"public class Program\r\n" +
"{\r\n" +
"\t[STAThread]\r\n" +
"\tstatic void Main(string[] args)\r\n" +
"\t{\r\n" +
"\t}\r\n" +
"}";
SnippetCompilerProject() : base(new Solution())
{
Create();
}
public static string SnippetFileName {
get { return GetFullFileName("Snippet.cs"); }
}
public static string SnippetProjectFileName {
get { return GetFullFileName("Snippet.csproj"); }
}
public override LanguageProperties LanguageProperties {
get { return LanguageProperties.None; }
}
public override string Language {
get { return "C#"; }
}
public const string DefaultTargetsFile = @"$(MSBuildBinPath)\Microsoft.CSharp.Targets";
protected override void Create(ProjectCreateInformation information)
{
this.AddImport(DefaultTargetsFile, null);
// Add import before base.Create call - base.Create will call AddOrRemoveExtensions, which
// needs to change the import when the compact framework is targeted.
base.Create(information);
SetProperty("Debug", null, "CheckForOverflowUnderflow", "True",
PropertyStorageLocations.ConfigurationSpecific, true);
SetProperty("Release", null, "CheckForOverflowUnderflow", "False",
PropertyStorageLocations.ConfigurationSpecific, true);
SetProperty("Debug", null, "DefineConstants", "DEBUG;TRACE",
PropertyStorageLocations.ConfigurationSpecific, false);
SetProperty("Release", null, "DefineConstants", "TRACE",
PropertyStorageLocations.ConfigurationSpecific, false);
}
public override ItemType GetDefaultItemType(string fileName)
{
if (string.Equals(Path.GetExtension(fileName), ".cs", StringComparison.OrdinalIgnoreCase)) {
return ItemType.Compile;
} else {
return base.GetDefaultItemType(fileName);
}
}
public static void Load()
{
CreateSnippetProject();
CreateSnippetFile();
ProjectService.LoadProject(SnippetProjectFileName);
}
void Create()
{
ProjectCreateInformation info = new ProjectCreateInformation();
info.Solution = new Solution();
info.OutputProjectFileName = Path.Combine(PropertyService.ConfigDirectory, "SharpSnippet.exe");
info.ProjectName = "SharpSnippet";
Create(info);
this.Parent = info.Solution;
}
/// <summary>
/// Loads the snippet project or creates one if it does not already exist.
/// </summary>
static void CreateSnippetProject()
{
string fileName = SnippetProjectFileName;
if (!File.Exists(fileName)) {
// Add single snippet file to project.
SnippetCompilerProject project = new SnippetCompilerProject();
FileProjectItem item = new FileProjectItem(project, ItemType.Compile, "Snippet.cs");
ProjectService.AddProjectItem(project, item);
project.Save(fileName);
}
}
/// <summary>
/// Loads the snippet file or creates one if it does not already exist.
/// </summary>
static void CreateSnippetFile()
{
string fileName = SnippetFileName;
if (!File.Exists(fileName)) {
LoggingService.Info("Creating Snippet.cs file: " + fileName);
using (StreamWriter snippetFile = File.CreateText(fileName)) {
snippetFile.Write(DefaultSnippetSource);
}
}
}
/// <summary>
/// All snippet compiler files are stored loaded from the config directory so this
/// method prefixes the filename with this path.
/// </summary>
public static string GetFullFileName(string fileName)
{
return Path.Combine(PropertyService.ConfigDirectory, fileName);
}
}
}

40
samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/SnippetFile.cs

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// </file>
using System;
using System.Collections.Generic;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SharpSnippetCompiler.Core
{
public class SnippetFile : OpenedFile
{
public SnippetFile(string fileName)
{
this.FileName = fileName;
IsUntitled = false;
}
public override IList<IViewContent> RegisteredViewContents {
get {
throw new NotImplementedException();
}
}
public override void RegisterView(IViewContent view)
{
throw new NotImplementedException();
}
public override void UnregisterView(IViewContent view)
{
throw new NotImplementedException();
}
}
}

197
samples/SharpSnippetCompiler/SharpSnippetCompiler.Core/Workbench.cs

@ -0,0 +1,197 @@ @@ -0,0 +1,197 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SharpSnippetCompiler.Core
{
public class Workbench : IWorkbench
{
readonly static string viewContentPath = "/SharpDevelop/Workbench/Pads";
Form mainForm;
List<PadDescriptor> padDescriptors = new List<PadDescriptor>();
List<IViewContent> views = new List<IViewContent>();
IWorkbenchLayout workbenchLayout;
IViewContent activeViewContent;
object activeContent;
public event EventHandler ActiveWorkbenchWindowChanged;
public event EventHandler ActiveViewContentChanged;
public event EventHandler ActiveContentChanged;
public event ViewContentEventHandler ViewOpened;
public event ViewContentEventHandler ViewClosed;
public event KeyEventHandler ProcessCommandKey;
public Workbench(Form mainForm)
{
this.mainForm = mainForm;
}
public Form MainForm {
get { return mainForm; }
}
public string Title {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public ICollection<IViewContent> ViewContentCollection {
get { return views; }
}
public IList<IWorkbenchWindow> WorkbenchWindowCollection {
get {
throw new NotImplementedException();
}
}
public IList<PadDescriptor> PadContentCollection {
get { return padDescriptors; }
}
public IWorkbenchWindow ActiveWorkbenchWindow {
get {
throw new NotImplementedException();
}
}
public IViewContent ActiveViewContent {
get { return activeViewContent; }
set { activeViewContent = value; }
}
public object ActiveContent {
get { return activeContent; }
set { activeContent = value; }
}
public IWorkbenchLayout WorkbenchLayout {
get { return workbenchLayout; }
set { workbenchLayout = value; }
}
public bool IsActiveWindow {
get {
throw new NotImplementedException();
}
}
public void ShowView(IViewContent content)
{
throw new NotImplementedException();
}
public void ShowPad(PadDescriptor content)
{
throw new NotImplementedException();
}
public void UnloadPad(PadDescriptor content)
{
throw new NotImplementedException();
}
public PadDescriptor GetPad(Type type)
{
foreach (PadDescriptor pad in padDescriptors) {
if (pad.Class == type.FullName) {
return pad;
}
}
return null;
}
public void CloseContent(IViewContent content)
{
throw new NotImplementedException();
}
public void CloseAllViews()
{
throw new NotImplementedException();
}
public void RedrawAllComponents()
{
throw new NotImplementedException();
}
public Properties CreateMemento()
{
throw new NotImplementedException();
}
public void SetMemento(Properties memento)
{
Console.WriteLine("Workbench.SetMemento not implemented");
}
public void UpdateRenderer()
{
Console.WriteLine("Workbench.UpdateRenderer not implemented");
}
public void Initialize()
{
try {
ArrayList contents = AddInTree.GetTreeNode(viewContentPath).BuildChildItems(this);
foreach (PadDescriptor content in contents) {
if (content != null) {
padDescriptors.Add(content);
}
}
} catch (TreePathNotFoundException) {}
}
protected virtual void OnActiveWorkbenchWindowChanged(EventArgs e)
{
if (ActiveWorkbenchWindowChanged != null) {
ActiveWorkbenchWindowChanged(this, e);
}
}
protected virtual void OnActiveViewContentChanged(EventArgs e)
{
if (ActiveViewContentChanged != null) {
ActiveViewContentChanged(this, e);
}
}
protected virtual void OnActiveContentChanged(EventArgs e)
{
if (ActiveContentChanged != null) {
ActiveContentChanged(this, e);
}
}
protected virtual void OnViewOpened(ViewContentEventArgs e)
{
if (ViewOpened != null) {
ViewOpened(this, e);
}
}
protected virtual void OnViewClosed(ViewContentEventArgs e)
{
if (ViewClosed != null) {
ViewClosed(this, e);
}
}
protected virtual void OnProcessCommandKey(KeyEventArgs e)
{
if (ProcessCommandKey != null) {
ProcessCommandKey(this, e);
}
}
}
}

BIN
samples/SharpSnippetCompiler/SharpSnippetCompiler.rtf

Binary file not shown.

24
samples/SharpSnippetCompiler/SharpSnippetCompiler.sln

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
# SharpDevelop 3.0.0.3093
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpSnippetCompiler", "SharpSnippetCompiler\SharpSnippetCompiler.csproj", "{A63633B4-2C31-4CFF-B2A3-92EAB1AB448E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpSnippetCompiler.Core", "SharpSnippetCompiler.Core\SharpSnippetCompiler.Core.csproj", "{5A2EC8F7-2274-4EA3-AC7A-6D1C8598F938}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A63633B4-2C31-4CFF-B2A3-92EAB1AB448E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A63633B4-2C31-4CFF-B2A3-92EAB1AB448E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A63633B4-2C31-4CFF-B2A3-92EAB1AB448E}.Release|Any CPU.Build.0 = Release|Any CPU
{A63633B4-2C31-4CFF-B2A3-92EAB1AB448E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5A2EC8F7-2274-4EA3-AC7A-6D1C8598F938}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5A2EC8F7-2274-4EA3-AC7A-6D1C8598F938}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5A2EC8F7-2274-4EA3-AC7A-6D1C8598F938}.Release|Any CPU.Build.0 = Release|Any CPU
{5A2EC8F7-2274-4EA3-AC7A-6D1C8598F938}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
EndGlobal

31
samples/SharpSnippetCompiler/SharpSnippetCompiler/AssemblyInfo.cs

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
#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("SharpSnippetCompiler")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SharpSnippetCompiler")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// This sets the default COM visibility of types in the assembly to invisible.
// If you need to expose a type to COM, use [ComVisible(true)] on that type.
[assembly: ComVisible(false)]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.*")]

458
samples/SharpSnippetCompiler/SharpSnippetCompiler/MainForm.Designer.cs generated

@ -0,0 +1,458 @@ @@ -0,0 +1,458 @@
// SharpDevelop samples
// Copyright (c) 2008, AlphaSierraPapa
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this list
// of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace ICSharpCode.SharpSnippetCompiler
{
partial class MainForm
{
/// <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.mainMenuStrip = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fileNewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fileOpenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fileCloseToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fileExitToolStripSeparator = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.undoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.redoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.redoSeparatorToolStripMenuItem = new System.Windows.Forms.ToolStripSeparator();
this.cutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.selectAllSeparatorToolStripMenuItem = new System.Windows.Forms.ToolStripSeparator();
this.selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.buildtoolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.buildCurrentToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.debugToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.runToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.stopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.continueSeparatorToolStripMenuItem = new System.Windows.Forms.ToolStripSeparator();
this.continueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.stepSeparatorToolStripMenuItem = new System.Windows.Forms.ToolStripSeparator();
this.stepOverToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.stepIntoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.stepOutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.referencesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.splitContainer = new System.Windows.Forms.SplitContainer();
this.fileTabControl = new System.Windows.Forms.TabControl();
this.tabControl = new System.Windows.Forms.TabControl();
this.errorsTabPage = new System.Windows.Forms.TabPage();
this.outputTabPage = new System.Windows.Forms.TabPage();
this.mainMenuStrip.SuspendLayout();
this.splitContainer.Panel1.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout();
this.splitContainer.SuspendLayout();
this.tabControl.SuspendLayout();
this.SuspendLayout();
//
// mainMenuStrip
//
this.mainMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem,
this.editToolStripMenuItem,
this.buildtoolStripMenuItem,
this.debugToolStripMenuItem,
this.toolsToolStripMenuItem});
this.mainMenuStrip.Location = new System.Drawing.Point(0, 0);
this.mainMenuStrip.Name = "mainMenuStrip";
this.mainMenuStrip.Size = new System.Drawing.Size(757, 24);
this.mainMenuStrip.TabIndex = 0;
this.mainMenuStrip.Text = "menuStrip1";
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileNewToolStripMenuItem,
this.fileOpenToolStripMenuItem,
this.fileCloseToolStripMenuItem,
this.fileExitToolStripSeparator,
this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "&File";
//
// fileNewToolStripMenuItem
//
this.fileNewToolStripMenuItem.Name = "fileNewToolStripMenuItem";
this.fileNewToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.fileNewToolStripMenuItem.Text = "&New...";
this.fileNewToolStripMenuItem.Click += new System.EventHandler(this.FileNewToolStripMenuItemClick);
//
// fileOpenToolStripMenuItem
//
this.fileOpenToolStripMenuItem.Name = "fileOpenToolStripMenuItem";
this.fileOpenToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.fileOpenToolStripMenuItem.Text = "&Open...";
this.fileOpenToolStripMenuItem.Click += new System.EventHandler(this.FileOpenToolStripMenuItemClick);
//
// fileCloseToolStripMenuItem
//
this.fileCloseToolStripMenuItem.Name = "fileCloseToolStripMenuItem";
this.fileCloseToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.fileCloseToolStripMenuItem.Text = "&Close";
this.fileCloseToolStripMenuItem.Click += new System.EventHandler(this.FileCloseToolStripMenuItemClick);
//
// fileExitToolStripSeparator
//
this.fileExitToolStripSeparator.Name = "fileExitToolStripSeparator";
this.fileExitToolStripSeparator.Size = new System.Drawing.Size(149, 6);
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.ExitToolStripMenuItemClick);
//
// editToolStripMenuItem
//
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.undoToolStripMenuItem,
this.redoToolStripMenuItem,
this.redoSeparatorToolStripMenuItem,
this.cutToolStripMenuItem,
this.copyToolStripMenuItem,
this.pasteToolStripMenuItem,
this.deleteToolStripMenuItem,
this.selectAllSeparatorToolStripMenuItem,
this.selectAllToolStripMenuItem});
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
this.editToolStripMenuItem.Text = "&Edit";
//
// undoToolStripMenuItem
//
this.undoToolStripMenuItem.Name = "undoToolStripMenuItem";
this.undoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z)));
this.undoToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
this.undoToolStripMenuItem.Text = "&Undo";
this.undoToolStripMenuItem.Click += new System.EventHandler(this.UndoToolStripMenuItemClick);
//
// redoToolStripMenuItem
//
this.redoToolStripMenuItem.Name = "redoToolStripMenuItem";
this.redoToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y)));
this.redoToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
this.redoToolStripMenuItem.Text = "&Redo";
this.redoToolStripMenuItem.Click += new System.EventHandler(this.RedoToolStripMenuItemClick);
//
// redoSeparatorToolStripMenuItem
//
this.redoSeparatorToolStripMenuItem.Name = "redoSeparatorToolStripMenuItem";
this.redoSeparatorToolStripMenuItem.Size = new System.Drawing.Size(161, 6);
//
// cutToolStripMenuItem
//
this.cutToolStripMenuItem.Name = "cutToolStripMenuItem";
this.cutToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X)));
this.cutToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
this.cutToolStripMenuItem.Text = "Cu&t";
this.cutToolStripMenuItem.Click += new System.EventHandler(this.CutToolStripMenuItemClick);
//
// copyToolStripMenuItem
//
this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
this.copyToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C)));
this.copyToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
this.copyToolStripMenuItem.Text = "&Copy";
this.copyToolStripMenuItem.Click += new System.EventHandler(this.CopyToolStripMenuItemClick);
//
// pasteToolStripMenuItem
//
this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
this.pasteToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V)));
this.pasteToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
this.pasteToolStripMenuItem.Text = "&Paste";
this.pasteToolStripMenuItem.Click += new System.EventHandler(this.PasteToolStripMenuItemClick);
//
// deleteToolStripMenuItem
//
this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
this.deleteToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
this.deleteToolStripMenuItem.Text = "&Delete";
this.deleteToolStripMenuItem.Click += new System.EventHandler(this.DeleteToolStripMenuItemClick);
//
// selectAllSeparatorToolStripMenuItem
//
this.selectAllSeparatorToolStripMenuItem.Name = "selectAllSeparatorToolStripMenuItem";
this.selectAllSeparatorToolStripMenuItem.Size = new System.Drawing.Size(161, 6);
//
// selectAllToolStripMenuItem
//
this.selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem";
this.selectAllToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A)));
this.selectAllToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
this.selectAllToolStripMenuItem.Text = "Select &All";
this.selectAllToolStripMenuItem.Click += new System.EventHandler(this.SelectAllToolStripMenuItemClick);
//
// buildtoolStripMenuItem
//
this.buildtoolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.buildCurrentToolStripMenuItem});
this.buildtoolStripMenuItem.Name = "buildtoolStripMenuItem";
this.buildtoolStripMenuItem.Size = new System.Drawing.Size(46, 20);
this.buildtoolStripMenuItem.Text = "&Build";
//
// buildCurrentToolStripMenuItem
//
this.buildCurrentToolStripMenuItem.Name = "buildCurrentToolStripMenuItem";
this.buildCurrentToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)(((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift)
| System.Windows.Forms.Keys.B)));
this.buildCurrentToolStripMenuItem.Size = new System.Drawing.Size(217, 22);
this.buildCurrentToolStripMenuItem.Text = "&Build Current";
this.buildCurrentToolStripMenuItem.Click += new System.EventHandler(this.BuildCurrentToolStripMenuItemClick);
//
// debugToolStripMenuItem
//
this.debugToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.runToolStripMenuItem,
this.stopToolStripMenuItem,
this.continueSeparatorToolStripMenuItem,
this.continueToolStripMenuItem,
this.stepSeparatorToolStripMenuItem,
this.stepOverToolStripMenuItem,
this.stepIntoToolStripMenuItem,
this.stepOutToolStripMenuItem});
this.debugToolStripMenuItem.Name = "debugToolStripMenuItem";
this.debugToolStripMenuItem.Size = new System.Drawing.Size(54, 20);
this.debugToolStripMenuItem.Text = "&Debug";
//
// runToolStripMenuItem
//
this.runToolStripMenuItem.Name = "runToolStripMenuItem";
this.runToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F5;
this.runToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
this.runToolStripMenuItem.Text = "&Run";
this.runToolStripMenuItem.Click += new System.EventHandler(this.RunToolStripMenuItemClick);
//
// stopToolStripMenuItem
//
this.stopToolStripMenuItem.Name = "stopToolStripMenuItem";
this.stopToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
this.stopToolStripMenuItem.Text = "St&op";
this.stopToolStripMenuItem.Click += new System.EventHandler(this.StopToolStripMenuItemClick);
//
// continueSeparatorToolStripMenuItem
//
this.continueSeparatorToolStripMenuItem.Name = "continueSeparatorToolStripMenuItem";
this.continueSeparatorToolStripMenuItem.Size = new System.Drawing.Size(174, 6);
//
// continueToolStripMenuItem
//
this.continueToolStripMenuItem.Name = "continueToolStripMenuItem";
this.continueToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F6;
this.continueToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
this.continueToolStripMenuItem.Text = "&Continue";
this.continueToolStripMenuItem.Click += new System.EventHandler(this.ContinueToolStripMenuItemClick);
//
// stepSeparatorToolStripMenuItem
//
this.stepSeparatorToolStripMenuItem.Name = "stepSeparatorToolStripMenuItem";
this.stepSeparatorToolStripMenuItem.Size = new System.Drawing.Size(174, 6);
//
// stepOverToolStripMenuItem
//
this.stepOverToolStripMenuItem.Name = "stepOverToolStripMenuItem";
this.stepOverToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F10;
this.stepOverToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
this.stepOverToolStripMenuItem.Text = "Step O&ver";
this.stepOverToolStripMenuItem.Click += new System.EventHandler(this.StepOverToolStripMenuItemClick);
//
// stepIntoToolStripMenuItem
//
this.stepIntoToolStripMenuItem.Name = "stepIntoToolStripMenuItem";
this.stepIntoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F11;
this.stepIntoToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
this.stepIntoToolStripMenuItem.Text = "Step &Into";
this.stepIntoToolStripMenuItem.Click += new System.EventHandler(this.StepIntoToolStripMenuItemClick);
//
// stepOutToolStripMenuItem
//
this.stepOutToolStripMenuItem.Name = "stepOutToolStripMenuItem";
this.stepOutToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Shift | System.Windows.Forms.Keys.F11)));
this.stepOutToolStripMenuItem.Size = new System.Drawing.Size(177, 22);
this.stepOutToolStripMenuItem.Text = "Step O&ut";
this.stepOutToolStripMenuItem.Click += new System.EventHandler(this.StepOutToolStripMenuItemClick);
//
// toolsToolStripMenuItem
//
this.toolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.referencesToolStripMenuItem});
this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
this.toolsToolStripMenuItem.Text = "&Tools";
//
// referencesToolStripMenuItem
//
this.referencesToolStripMenuItem.Name = "referencesToolStripMenuItem";
this.referencesToolStripMenuItem.Size = new System.Drawing.Size(140, 22);
this.referencesToolStripMenuItem.Text = "&References...";
this.referencesToolStripMenuItem.Click += new System.EventHandler(this.ReferencesToolStripMenuItemClick);
//
// splitContainer
//
this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer.Location = new System.Drawing.Point(0, 24);
this.splitContainer.Name = "splitContainer";
this.splitContainer.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
// splitContainer.Panel1
//
this.splitContainer.Panel1.Controls.Add(this.fileTabControl);
//
// splitContainer.Panel2
//
this.splitContainer.Panel2.Controls.Add(this.tabControl);
this.splitContainer.Size = new System.Drawing.Size(757, 349);
this.splitContainer.SplitterDistance = 225;
this.splitContainer.TabIndex = 1;
//
// fileTabControl
//
this.fileTabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.fileTabControl.Location = new System.Drawing.Point(0, 0);
this.fileTabControl.Name = "fileTabControl";
this.fileTabControl.SelectedIndex = 0;
this.fileTabControl.Size = new System.Drawing.Size(757, 225);
this.fileTabControl.TabIndex = 0;
this.fileTabControl.SelectedIndexChanged += new System.EventHandler(this.FileTabControlSelectedIndexChanged);
//
// tabControl
//
this.tabControl.Controls.Add(this.errorsTabPage);
this.tabControl.Controls.Add(this.outputTabPage);
this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControl.Location = new System.Drawing.Point(0, 0);
this.tabControl.Name = "tabControl";
this.tabControl.SelectedIndex = 0;
this.tabControl.Size = new System.Drawing.Size(757, 120);
this.tabControl.TabIndex = 0;
//
// errorsTabPage
//
this.errorsTabPage.Location = new System.Drawing.Point(4, 22);
this.errorsTabPage.Name = "errorsTabPage";
this.errorsTabPage.Padding = new System.Windows.Forms.Padding(3);
this.errorsTabPage.Size = new System.Drawing.Size(749, 94);
this.errorsTabPage.TabIndex = 0;
this.errorsTabPage.Text = "Errors";
this.errorsTabPage.UseVisualStyleBackColor = true;
//
// outputTabPage
//
this.outputTabPage.Location = new System.Drawing.Point(4, 22);
this.outputTabPage.Name = "outputTabPage";
this.outputTabPage.Padding = new System.Windows.Forms.Padding(3);
this.outputTabPage.Size = new System.Drawing.Size(749, 94);
this.outputTabPage.TabIndex = 1;
this.outputTabPage.Text = "Output";
this.outputTabPage.UseVisualStyleBackColor = true;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(757, 373);
this.Controls.Add(this.splitContainer);
this.Controls.Add(this.mainMenuStrip);
this.MainMenuStrip = this.mainMenuStrip;
this.Name = "MainForm";
this.Text = "SharpSnippetCompiler";
this.mainMenuStrip.ResumeLayout(false);
this.mainMenuStrip.PerformLayout();
this.splitContainer.Panel1.ResumeLayout(false);
this.splitContainer.Panel2.ResumeLayout(false);
this.splitContainer.ResumeLayout(false);
this.tabControl.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.ToolStripSeparator fileExitToolStripSeparator;
private System.Windows.Forms.ToolStripMenuItem fileCloseToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem fileOpenToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem fileNewToolStripMenuItem;
private System.Windows.Forms.TabControl fileTabControl;
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator redoSeparatorToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator selectAllSeparatorToolStripMenuItem;
private System.Windows.Forms.TabPage outputTabPage;
private System.Windows.Forms.TabPage errorsTabPage;
private System.Windows.Forms.TabControl tabControl;
private System.Windows.Forms.SplitContainer splitContainer;
private System.Windows.Forms.ToolStripMenuItem referencesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem pasteToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem cutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem redoToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem undoToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem stepOutToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem stepIntoToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem stepOverToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator stepSeparatorToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem continueToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator continueSeparatorToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem stopToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem buildCurrentToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem buildtoolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem runToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem debugToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.MenuStrip mainMenuStrip;
}
}

370
samples/SharpSnippetCompiler/SharpSnippetCompiler/MainForm.cs

@ -0,0 +1,370 @@ @@ -0,0 +1,370 @@
// SharpDevelop samples
// Copyright (c) 2008, AlphaSierraPapa
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this list
// of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Commands;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Project.Commands;
using ICSharpCode.TextEditor;
using ICSharpCode.SharpSnippetCompiler.Core;
namespace ICSharpCode.SharpSnippetCompiler
{
public partial class MainForm : Form
{
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
}
public Control ErrorList {
get {
if (errorsTabPage.Controls.Count > 0) {
return errorsTabPage.Controls[0];
}
return null;
}
set {
errorsTabPage.Controls.Clear();
value.Dock = DockStyle.Fill;
errorsTabPage.Controls.Add(value);
}
}
public Control OutputList {
get {
if (outputTabPage.Controls.Count > 0) {
return outputTabPage.Controls[0];
}
return null;
}
set {
outputTabPage.Controls.Clear();
value.Dock = DockStyle.Fill;
outputTabPage.Controls.Add(value);
}
}
/// <summary>
/// Gets the active text editor control.
/// </summary>
public TextEditorControl TextEditor {
get {
return ActiveSnippetTabPage.SnippetCompilerControl.TextEditor;
}
}
public SnippetTabPage ActiveSnippetTabPage {
get { return fileTabControl.SelectedTab as SnippetTabPage; }
}
public void LoadFile(string fileName)
{
// Create a new tab page.
SharpSnippetCompilerControl snippetControl = new SharpSnippetCompilerControl();
snippetControl.Dock = DockStyle.Fill;
SnippetTabPage tabPage = new SnippetTabPage(snippetControl);
tabPage.Text = Path.GetFileName(fileName);
fileTabControl.TabPages.Add(tabPage);
// Load file
snippetControl.LoadFile(fileName);
snippetControl.Focus();
WorkbenchWindow window = new WorkbenchWindow(fileTabControl, tabPage);
MainViewContent view = new MainViewContent(fileName, snippetControl, window);
WorkbenchSingleton.Workbench.ViewContentCollection.Add(view);
UpdateActiveView(view);
}
public void ActivateErrorList()
{
tabControl.SelectedIndex = 0;
}
public void ActivateOutputList()
{
tabControl.SelectedIndex = 1;
}
void ExitToolStripMenuItemClick(object sender, EventArgs e)
{
SaveAll();
Close();
}
void BuildCurrentToolStripMenuItemClick(object sender, EventArgs e)
{
SaveAll();
BuildSnippetCommand buildSnippet = new BuildSnippetCommand(ProjectService.CurrentProject);
buildSnippet.Run();
}
void RunToolStripMenuItemClick(object sender, EventArgs e)
{
SaveAll();
Execute execute = new Execute();
execute.Run();
}
void ContinueToolStripMenuItemClick(object sender, EventArgs e)
{
ContinueDebuggingCommand continueCommand = new ContinueDebuggingCommand();
continueCommand.Run();
}
void StepOverToolStripMenuItemClick(object sender, EventArgs e)
{
StepDebuggingCommand stepCommand = new StepDebuggingCommand();
stepCommand.Run();
}
void StepIntoToolStripMenuItemClick(object sender, EventArgs e)
{
StepIntoDebuggingCommand stepCommand = new StepIntoDebuggingCommand();
stepCommand.Run();
}
void StepOutToolStripMenuItemClick(object sender, EventArgs e)
{
StepOutDebuggingCommand stepCommand = new StepOutDebuggingCommand();
stepCommand.Run();
}
void StopToolStripMenuItemClick(object sender, EventArgs e)
{
StopDebuggingCommand stopCommand = new StopDebuggingCommand();
stopCommand.Run();
}
void UndoToolStripMenuItemClick(object sender, EventArgs e)
{
Undo undo = new Undo();
undo.Run();
}
void RedoToolStripMenuItemClick(object sender, EventArgs e)
{
Redo redo = new Redo();
redo.Run();
}
void CutToolStripMenuItemClick(object sender, EventArgs e)
{
Cut cut = new Cut();
cut.Run();
}
void CopyToolStripMenuItemClick(object sender, EventArgs e)
{
Copy copy = new Copy();
copy.Run();
}
void PasteToolStripMenuItemClick(object sender, EventArgs e)
{
Paste paste = new Paste();
paste.Run();
}
void DeleteToolStripMenuItemClick(object sender, EventArgs e)
{
Delete delete = new Delete();
delete.Run();
}
void SelectAllToolStripMenuItemClick(object sender, EventArgs e)
{
SelectAll selectAll = new SelectAll();
selectAll.Run();
}
void ReferencesToolStripMenuItemClick(object sender, EventArgs e)
{
IProject project = ProjectService.CurrentProject;
using (SelectReferenceDialog referenceDialog = new SelectReferenceDialog(project)) {
// Add existing project references to dialog.
List<ReferenceProjectItem> references = GetReferences(project);
AddReferences(referenceDialog as ISelectReferenceDialog, references);
DialogResult result = referenceDialog.ShowDialog();
if (result == DialogResult.OK) {
ArrayList selectedReferences = referenceDialog.ReferenceInformations;
// Remove any references removed in the select reference dialog.
foreach (ReferenceProjectItem existingReference in references) {
if (!selectedReferences.Contains(existingReference)) {
ProjectService.RemoveProjectItem(project, existingReference);
}
}
// Add new references.
foreach (ReferenceProjectItem reference in referenceDialog.ReferenceInformations) {
if (!reference.IsAddedToProject) {
ProjectService.AddProjectItem(project, reference);
}
}
project.Save();
}
}
}
List<ReferenceProjectItem> GetReferences(IProject project)
{
List<ReferenceProjectItem> references = new List<ReferenceProjectItem>();
foreach (ProjectItem item in project.Items) {
ReferenceProjectItem reference = item as ReferenceProjectItem;
if (reference != null) {
references.Add(reference);
}
}
return references;
}
void AddReferences(ISelectReferenceDialog dialog, List<ReferenceProjectItem> references)
{
foreach (ReferenceProjectItem reference in references) {
dialog.AddReference(reference.Include, "Gac", reference.FileName, reference);
}
}
void UpdateActiveView(IViewContent view)
{
Workbench workbench = WorkbenchSingleton.Workbench as Workbench;
workbench.ActiveViewContent = view;
workbench.ActiveContent = view;
}
void FileTabControlSelectedIndexChanged(object sender, EventArgs e)
{
UpdateActiveView();
}
void UpdateActiveView()
{
if (ActiveSnippetTabPage != null) {
SharpSnippetCompilerControl control = ActiveSnippetTabPage.SnippetCompilerControl;
foreach (IViewContent view in WorkbenchSingleton.Workbench.ViewContentCollection) {
if (view.Control == control) {
UpdateActiveView(view);
return;
}
}
} else {
UpdateActiveView(null);
}
}
void SaveAll()
{
foreach (SnippetTabPage tabPage in fileTabControl.TabPages) {
tabPage.SnippetCompilerControl.Save();
}
}
void FileNewToolStripMenuItemClick(object sender, EventArgs e)
{
using (NewFileDialog dialog = new NewFileDialog()) {
dialog.FileName = GetNewFileName();
if (dialog.ShowDialog() == DialogResult.OK) {
string fileName = dialog.FileName;
using (StreamWriter file = File.CreateText(fileName)) {
file.Write(String.Empty);
}
LoadFile(fileName);
AddFileToProject(fileName);
}
}
}
string GetNewFileName()
{
string fileName = SnippetCompilerProject.GetFullFileName("Snippet1.cs");
string baseFolder = Path.GetDirectoryName(fileName);
int count = 1;
while (File.Exists(fileName)) {
count++;
fileName = Path.Combine(baseFolder, "Snippet" + count.ToString() + ".cs");
}
return fileName;
}
void FileOpenToolStripMenuItemClick(object sender, EventArgs e)
{
using (OpenFileDialog dialog = new OpenFileDialog()) {
dialog.CheckFileExists = true;
if (dialog.ShowDialog() == DialogResult.OK) {
foreach (string fileName in dialog.FileNames) {
LoadFile(fileName);
AddFileToProject(fileName);
}
}
}
}
void AddFileToProject(string fileName)
{
IProject project = ProjectService.CurrentProject;
FileProjectItem item = new FileProjectItem(project, ItemType.Compile, fileName);
ProjectService.AddProjectItem(project, item);
project.Save();
}
void FileCloseToolStripMenuItemClick(object sender, EventArgs e)
{
SnippetTabPage activeTabPage = ActiveSnippetTabPage;
if (activeTabPage != null) {
SharpSnippetCompilerControl snippetControl = activeTabPage.SnippetCompilerControl;
snippetControl.Save();
string fileName = ActiveSnippetTabPage.SnippetCompilerControl.TextEditor.FileName;
IProject project = ProjectService.CurrentProject;
FileProjectItem item = project.FindFile(fileName);
if (item != null) {
ProjectService.RemoveProjectItem(project, item);
project.Save();
fileTabControl.TabPages.Remove(activeTabPage);
activeTabPage.Dispose();
}
}
}
}
}

123
samples/SharpSnippetCompiler/SharpSnippetCompiler/MainForm.resx

@ -0,0 +1,123 @@ @@ -0,0 +1,123 @@
<?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>
<metadata name="mainMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

117
samples/SharpSnippetCompiler/SharpSnippetCompiler/NewFileDialog.Designer.cs generated

@ -0,0 +1,117 @@ @@ -0,0 +1,117 @@
// SharpDevelop samples
// Copyright (c) 2008, AlphaSierraPapa
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this list
// of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace ICSharpCode.SharpSnippetCompiler
{
partial class NewFileDialog
{
/// <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.cancelButton = new System.Windows.Forms.Button();
this.okButton = new System.Windows.Forms.Button();
this.fileNameTextBox = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(340, 43);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 2;
this.cancelButton.Text = "Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(259, 43);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 1;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
//
// fileNameTextBox
//
this.fileNameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.fileNameTextBox.Location = new System.Drawing.Point(12, 13);
this.fileNameTextBox.Name = "fileNameTextBox";
this.fileNameTextBox.Size = new System.Drawing.Size(403, 20);
this.fileNameTextBox.TabIndex = 0;
//
// NewFileDialog
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(427, 78);
this.Controls.Add(this.fileNameTextBox);
this.Controls.Add(this.okButton);
this.Controls.Add(this.cancelButton);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(205, 114);
this.Name = "NewFileDialog";
this.ShowInTaskbar = false;
this.Text = "New File";
this.ResumeLayout(false);
this.PerformLayout();
}
private System.Windows.Forms.TextBox fileNameTextBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
}
}

52
samples/SharpSnippetCompiler/SharpSnippetCompiler/NewFileDialog.cs

@ -0,0 +1,52 @@ @@ -0,0 +1,52 @@
// SharpDevelop samples
// Copyright (c) 2008, AlphaSierraPapa
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this list
// of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Drawing;
using System.Windows.Forms;
namespace ICSharpCode.SharpSnippetCompiler
{
/// <summary>
/// Description of NewFileDialog.
/// </summary>
public partial class NewFileDialog : Form
{
public NewFileDialog()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
}
public string FileName {
get { return fileNameTextBox.Text; }
set { fileNameTextBox.Text = value; }
}
}
}

120
samples/SharpSnippetCompiler/SharpSnippetCompiler/NewFileDialog.resx

@ -0,0 +1,120 @@ @@ -0,0 +1,120 @@
<?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>

13
samples/SharpSnippetCompiler/SharpSnippetCompiler/PreBuildEvent.proj

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PrepareForBuildDependsOn>$(PrepareForBuildDependsOn);MyPreBuildTarget</PrepareForBuildDependsOn>
</PropertyGroup>
<ItemGroup>
<CSharpBindingFile Include="..\..\..\AddIns\AddIns\BackendBindings\CSharpBinding\CSharpBinding.*" />
<DebuggerAddInFile Include="..\..\..\AddIns\AddIns\Misc\Debugger\Debugger.*" />
</ItemGroup>
<Target Name="MyPreBuildTarget">
<Copy SourceFiles="@(CSharpBindingFile)" DestinationFolder="$(OutputPath)AddIns\CSharpBinding" />
<Copy SourceFiles="@(DebuggerAddInFile)" DestinationFolder="$(OutputPath)AddIns\Debugger" />
</Target>
</Project>

108
samples/SharpSnippetCompiler/SharpSnippetCompiler/Program.cs

@ -0,0 +1,108 @@ @@ -0,0 +1,108 @@
// SharpDevelop samples
// Copyright (c) 2008, AlphaSierraPapa
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this list
// of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpSnippetCompiler.Core;
namespace ICSharpCode.SharpSnippetCompiler
{
public sealed class Program
{
MainForm mainForm;
[STAThread]
static void Main(string[] args)
{
Program program = new Program();
program.Run(args);
}
void Run(string[] args)
{
SharpSnippetCompilerManager.Init();
mainForm = new MainForm();
Workbench workbench = new Workbench(mainForm);
WorkbenchSingleton.InitializeWorkbench(workbench, new WorkbenchLayout());
PadDescriptor errorList = workbench.GetPad(typeof(ErrorListPad));
errorList.CreatePad();
mainForm.ErrorList = errorList.PadContent.Control;
PadDescriptor outputList = workbench.GetPad(typeof(CompilerMessageView));
outputList.CreatePad();
mainForm.OutputList = outputList.PadContent.Control;
mainForm.Visible = true;
SnippetCompilerProject.Load();
IProject project = GetCurrentProject();
ProjectService.CurrentProject = project;
LoadFiles(project);
ParserService.StartParserThread();
//WorkbenchSingleton.SafeThreadAsyncCall(new Action<Program>(LoadFile));
try {
Application.Run(mainForm);
} finally {
try {
// Save properties
//PropertyService.Save();
} catch (Exception ex) {
MessageService.ShowError(ex, "Properties could not be saved.");
}
}
}
void LoadFiles(IProject project)
{
foreach (ProjectItem item in project.Items) {
FileProjectItem fileItem = item as FileProjectItem;
if (fileItem != null && File.Exists(item.FileName)) {
mainForm.LoadFile(item.FileName);
}
}
}
IProject GetCurrentProject()
{
foreach (IProject project in ProjectService.OpenSolution.Projects) {
return project;
}
return null;
}
}
}

90
samples/SharpSnippetCompiler/SharpSnippetCompiler/SharpSnippetCompiler.csproj

@ -0,0 +1,90 @@ @@ -0,0 +1,90 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<ProjectGuid>{A63633B4-2C31-4CFF-B2A3-92EAB1AB448E}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Exe</OutputType>
<RootNamespace>ICSharpCode.SharpSnippetCompiler</RootNamespace>
<AssemblyName>SharpSnippetCompiler</AssemblyName>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>bin\</OutputPath>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>False</Optimize>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>bin\</OutputPath>
<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" />
<Import Project="PreBuildEvent.proj" />
<ItemGroup>
<Reference Include="ICSharpCode.Core">
<HintPath>..\..\..\bin\ICSharpCode.Core.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.SharpDevelop">
<HintPath>..\..\..\bin\ICSharpCode.SharpDevelop.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.TextEditor">
<HintPath>..\..\..\bin\ICSharpCode.TextEditor.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="MainForm.cs" />
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="NewFileDialog.cs" />
<Compile Include="NewFileDialog.Designer.cs">
<DependentUpon>NewFileDialog.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="SnippetTabPage.cs" />
<Compile Include="WorkbenchLayout.cs" />
<Compile Include="WorkbenchWindow.cs" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="NewFileDialog.resx">
<DependentUpon>NewFileDialog.cs</DependentUpon>
</EmbeddedResource>
<None Include="app.config" />
<None Include="bin\AddIns\SharpSnippetCompiler.addin">
<Link>SharpSnippetCompiler.addin</Link>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SharpSnippetCompiler.Core\SharpSnippetCompiler.Core.csproj">
<Project>{5A2EC8F7-2274-4EA3-AC7A-6D1C8598F938}</Project>
<Name>SharpSnippetCompiler.Core</Name>
</ProjectReference>
</ItemGroup>
</Project>

49
samples/SharpSnippetCompiler/SharpSnippetCompiler/SnippetTabPage.cs

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
// SharpDevelop samples
// Copyright (c) 2008, AlphaSierraPapa
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this list
// of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Windows.Forms;
using ICSharpCode.SharpSnippetCompiler.Core;
namespace ICSharpCode.SharpSnippetCompiler
{
public class SnippetTabPage : TabPage
{
SharpSnippetCompilerControl snippetControl;
public SnippetTabPage(SharpSnippetCompilerControl snippetControl)
{
this.snippetControl = snippetControl;
Controls.Add(snippetControl);
}
public SharpSnippetCompilerControl SnippetCompilerControl {
get { return snippetControl; }
}
}
}

128
samples/SharpSnippetCompiler/SharpSnippetCompiler/WorkbenchLayout.cs

@ -0,0 +1,128 @@ @@ -0,0 +1,128 @@
// SharpDevelop samples
// Copyright (c) 2008, AlphaSierraPapa
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this list
// of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SharpSnippetCompiler
{
public class WorkbenchLayout : IWorkbenchLayout
{
public WorkbenchLayout()
{
}
public event EventHandler ActiveWorkbenchWindowChanged;
public IWorkbenchWindow ActiveWorkbenchWindow {
get {
throw new NotImplementedException();
}
}
public object ActiveContent {
get {
throw new NotImplementedException();
}
}
public void Attach(IWorkbench workbench)
{
throw new NotImplementedException();
}
public void Detach()
{
throw new NotImplementedException();
}
public void ShowPad(PadDescriptor content)
{
Console.WriteLine("WorkbenchLayout.ShowPad not implemented");
}
public void ActivatePad(PadDescriptor content)
{
ActivatePad(content.Class);
}
public void ActivatePad(string fullyQualifiedTypeName)
{
Console.WriteLine("WorkbenchLayout.ActivatePad not implemented");
if (fullyQualifiedTypeName.EndsWith("ErrorListPad")) {
MainForm mainForm = WorkbenchSingleton.MainForm as MainForm;
mainForm.ActivateErrorList();
} else if (fullyQualifiedTypeName.EndsWith("CompilerMessageView")) {
MainForm mainForm = WorkbenchSingleton.MainForm as MainForm;
mainForm.ActivateOutputList();
}
}
public void HidePad(PadDescriptor content)
{
throw new NotImplementedException();
}
public void UnloadPad(PadDescriptor content)
{
throw new NotImplementedException();
}
public bool IsVisible(PadDescriptor padContent)
{
return false;
}
public void RedrawAllComponents()
{
throw new NotImplementedException();
}
public IWorkbenchWindow ShowView(IViewContent content)
{
throw new NotImplementedException();
}
public void LoadConfiguration()
{
Console.WriteLine("WorkbenchLayout.LoadConfiguration not implemented");
}
public void StoreConfiguration()
{
Console.WriteLine("WorkbenchLayout.StoreConfiguration not implemented");
}
protected virtual void OnActiveWorkbenchWindowChanged(EventArgs e)
{
if (ActiveWorkbenchWindowChanged != null) {
ActiveWorkbenchWindowChanged(this, e);
}
}
}
}

146
samples/SharpSnippetCompiler/SharpSnippetCompiler/WorkbenchWindow.cs

@ -0,0 +1,146 @@ @@ -0,0 +1,146 @@
// SharpDevelop samples
// Copyright (c) 2008, AlphaSierraPapa
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this list
// of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice, this list
// of conditions and the following disclaimer in the documentation and/or other materials
// provided with the distribution.
//
// - Neither the name of the SharpDevelop team nor the names of its contributors may be used to
// endorse or promote products derived from this software without specific prior written
// permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &AS IS& AND ANY EXPRESS
// OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
// IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SharpSnippetCompiler
{
public class WorkbenchWindow : IWorkbenchWindow
{
TabControl tabControl;
SnippetTabPage tabPage;
public WorkbenchWindow(TabControl tabControl, SnippetTabPage tabPage)
{
this.tabControl = tabControl;
this.tabPage = tabPage;
}
public event EventHandler ActiveViewContentChanged;
public event EventHandler WindowSelected;
public event EventHandler WindowDeselected;
public event EventHandler TitleChanged;
public event EventHandler CloseEvent;
public string Title {
get {
throw new NotImplementedException();
}
}
public bool IsDisposed {
get {
throw new NotImplementedException();
}
}
public IViewContent ActiveViewContent {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public Icon Icon {
get {
throw new NotImplementedException();
}
set {
throw new NotImplementedException();
}
}
public IList<IViewContent> ViewContents {
get {
throw new NotImplementedException();
}
}
public void SwitchView(int viewNumber)
{
throw new NotImplementedException();
}
public bool CloseWindow(bool force)
{
throw new NotImplementedException();
}
public void SelectWindow()
{
tabControl.SelectedTab = tabPage;
OnWindowSelected(new EventArgs());
}
public void RedrawContent()
{
throw new NotImplementedException();
}
public void OnWindowSelected(EventArgs e)
{
if (WindowSelected != null) {
WindowSelected(this, e);
}
}
public void OnWindowDeselected(EventArgs e)
{
if (WindowDeselected != null) {
WindowDeselected(this, e);
}
}
protected virtual void OnActiveViewContentChanged(EventArgs e)
{
if (ActiveViewContentChanged != null) {
ActiveViewContentChanged(this, e);
}
}
protected virtual void OnTitleChanged(EventArgs e)
{
if (TitleChanged != null) {
TitleChanged(this, e);
}
}
protected virtual void OnCloseEvent(EventArgs e)
{
if (CloseEvent != null) {
CloseEvent(this, e);
}
}
}
}

45
samples/SharpSnippetCompiler/SharpSnippetCompiler/app.config

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
<configuration>
<configSections>
<section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
</configSections>
<runtime>
<assemblyBinding>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="3.5.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<log4net>
<appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
<mapping>
<level value="FATAL" />
<foreColor value="Red, HighIntensity" />
</mapping>
<mapping>
<level value="ERROR" />
<foreColor value="Red" />
</mapping>
<mapping>
<level value="WARN" />
<foreColor value="Yellow" />
</mapping>
<mapping>
<level value="INFO" />
<foreColor value="White" />
</mapping>
<mapping>
<level value="DEBUG" />
<foreColor value="Green" />
</mapping>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level- %message%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="ColoredConsoleAppender" />
</root>
</log4net>
</configuration>

12
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockWorkbench.cs

@ -128,6 +128,18 @@ namespace PythonBinding.Tests.Utils @@ -128,6 +128,18 @@ namespace PythonBinding.Tests.Utils
throw new NotImplementedException();
}
public void UpdateRenderer()
{
}
public Form MainForm {
get { return null; }
}
public void Initialize()
{
}
ICollection<IViewContent> IWorkbench.ViewContentCollection {
get {
throw new NotImplementedException();

18
src/Main/Base/Project/Src/Gui/IWorkbench.cs

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Gui
@ -16,6 +17,13 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -16,6 +17,13 @@ namespace ICSharpCode.SharpDevelop.Gui
/// </summary>
public interface IWorkbench : IMementoCapable
{
/// <summary>
/// Gets the main form for the work bench.
/// </summary>
Form MainForm {
get;
}
/// <summary>
/// The title shown in the title bar.
/// </summary>
@ -96,6 +104,11 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -96,6 +104,11 @@ namespace ICSharpCode.SharpDevelop.Gui
get;
}
/// <summary>
/// Initializes the workbench.
/// </summary>
void Initialize();
/// <summary>
/// Inserts a new <see cref="IViewContent"/> object in the workspace.
/// </summary>
@ -133,6 +146,11 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -133,6 +146,11 @@ namespace ICSharpCode.SharpDevelop.Gui
/// </summary>
void RedrawAllComponents();
/// <summary>
/// Updates the toolstrip renderer.
/// </summary>
void UpdateRenderer();
/// <summary>
/// Is called, when a workbench view was opened
/// </summary>

6
src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs

@ -236,6 +236,10 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -236,6 +236,10 @@ namespace ICSharpCode.SharpDevelop.Gui
AllowDrop = true;
}
public Form MainForm {
get { return this; }
}
protected override void WndProc(ref Message m)
{
if (!SingleInstanceHelper.PreFilterMessage(ref m)) {
@ -245,7 +249,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -245,7 +249,7 @@ namespace ICSharpCode.SharpDevelop.Gui
System.Windows.Forms.Timer toolbarUpdateTimer;
public void InitializeWorkspace()
public void Initialize()
{
UpdateRenderer();

28
src/Main/Base/Project/Src/Gui/WorkbenchSingleton.cs

@ -19,14 +19,14 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -19,14 +19,14 @@ namespace ICSharpCode.SharpDevelop.Gui
const string workbenchMemento = "WorkbenchMemento";
static STAThreadCaller caller;
static DefaultWorkbench workbench;
static IWorkbench workbench;
/// <summary>
/// Gets the main form. Returns null in unit-testing mode.
/// </summary>
public static Form MainForm {
get {
return workbench as Form;
return workbench.MainForm;
}
}
@ -78,6 +78,13 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -78,6 +78,13 @@ namespace ICSharpCode.SharpDevelop.Gui
/// </summary>
public static void InitializeWorkbench()
{
InitializeWorkbench(new DefaultWorkbench(), new SdiWorkbenchLayout());
}
public static void InitializeWorkbench(IWorkbench workbench, IWorkbenchLayout layout)
{
WorkbenchSingleton.workbench = workbench;
DisplayBindingService.InitializeService();
LayoutConfiguration.LoadLayoutConfiguration();
FileService.InitializeService();
@ -87,19 +94,16 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -87,19 +94,16 @@ namespace ICSharpCode.SharpDevelop.Gui
Bookmarks.BookmarkManager.Initialize();
Project.CustomToolsService.Initialize();
workbench = new DefaultWorkbench();
MessageService.MainForm = workbench;
MessageService.MainForm = workbench.MainForm;
PropertyService.PropertyChanged += new PropertyChangedEventHandler(TrackPropertyChanges);
ResourceService.LanguageChanged += delegate { workbench.RedrawAllComponents(); };
caller = new STAThreadCaller(workbench);
workbench.InitializeWorkspace();
workbench.SetMemento(PropertyService.Get(workbenchMemento, new Properties()));
workbench.WorkbenchLayout = new SdiWorkbenchLayout();
caller = new STAThreadCaller(workbench.MainForm);
workbench.Initialize();
workbench.SetMemento(PropertyService.Get(workbenchMemento, new Properties()));
workbench.WorkbenchLayout = layout;
OnWorkbenchCreated();
@ -175,7 +179,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -175,7 +179,7 @@ namespace ICSharpCode.SharpDevelop.Gui
if (workbench == null)
return false; // unit test mode, don't crash
else
return ((Form)workbench).InvokeRequired;
return workbench.MainForm.InvokeRequired;
}
}

Loading…
Cancel
Save