Browse Source
The F# binding written in F# was problematic because the F# runtime is not installed on all computers where SharpDevelop is running. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5494 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61pull/1/head
19 changed files with 629 additions and 587 deletions
@ -1,66 +0,0 @@ |
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 10.00 |
|
||||||
# Visual Studio 2008 |
|
||||||
# SharpDevelop 3.0.0.3280 |
|
||||||
Project("{982E8BC1-ACD7-4dbf-96AB-B2CE67D6A008}") = "FSharpBinding", "FSharpBinding\Project\FSharpBinding.fsproj", "{99BAE3A2-C40D-40D2-A7B4-EBB4798F36E4}" |
|
||||||
EndProject |
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.TextEditor", "..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj", "{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}" |
|
||||||
EndProject |
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop", "..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj", "{2748AD25-9C63-4E12-877B-4DCE96FBED54}" |
|
||||||
EndProject |
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core", "..\..\..\Main\Core\Project\ICSharpCode.Core.csproj", "{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}" |
|
||||||
EndProject |
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.BuildWorker", "..\..\..\Main\ICSharpCode.SharpDevelop.BuildWorker\ICSharpCode.SharpDevelop.BuildWorker.csproj", "{C3CBC8E3-81D8-4C5B-9941-DCCD12D50B1F}" |
|
||||||
EndProject |
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Dom", "..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj", "{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}" |
|
||||||
EndProject |
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.SharpDevelop.Widgets", "..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj", "{8035765F-D51F-4A0C-A746-2FD100E19419}" |
|
||||||
EndProject |
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactory", "..\..\..\Libraries\NRefactory\Project\NRefactory.csproj", "{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}" |
|
||||||
EndProject |
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinFormsUI", "..\..\..\Libraries\DockPanel_Src\WinFormsUI\WinFormsUI.csproj", "{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}" |
|
||||||
EndProject |
|
||||||
Global |
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|
||||||
Debug|Any CPU = Debug|Any CPU |
|
||||||
Release|Any CPU = Release|Any CPU |
|
||||||
EndGlobalSection |
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
|
||||||
{99BAE3A2-C40D-40D2-A7B4-EBB4798F36E4}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||||
{99BAE3A2-C40D-40D2-A7B4-EBB4798F36E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||||
{99BAE3A2-C40D-40D2-A7B4-EBB4798F36E4}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||||
{99BAE3A2-C40D-40D2-A7B4-EBB4798F36E4}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||||
{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||||
{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||||
{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||||
{D3C782BA-178E-4235-A3BA-8C11DEBB6BEE}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||||
{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||||
{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||||
{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||||
{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||||
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||||
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||||
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||||
{2748AD25-9C63-4E12-877B-4DCE96FBED54}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||||
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||||
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||||
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||||
{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||||
{C3CBC8E3-81D8-4C5B-9941-DCCD12D50B1F}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||||
{C3CBC8E3-81D8-4C5B-9941-DCCD12D50B1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||||
{C3CBC8E3-81D8-4C5B-9941-DCCD12D50B1F}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||||
{C3CBC8E3-81D8-4C5B-9941-DCCD12D50B1F}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||||
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||||
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||||
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||||
{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||||
{8035765F-D51F-4A0C-A746-2FD100E19419}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||||
{8035765F-D51F-4A0C-A746-2FD100E19419}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||||
{8035765F-D51F-4A0C-A746-2FD100E19419}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||||
{8035765F-D51F-4A0C-A746-2FD100E19419}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||||
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|Any CPU.Build.0 = Debug|Any CPU |
|
||||||
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
|
||||||
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|Any CPU.Build.0 = Release|Any CPU |
|
||||||
{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}.Release|Any CPU.ActiveCfg = Release|Any CPU |
|
||||||
EndGlobalSection |
|
||||||
EndGlobal |
|
@ -1,120 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|
||||||
<PropertyGroup> |
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
|
||||||
<ProductVersion>8.0.30703</ProductVersion> |
|
||||||
<SchemaVersion>2.0</SchemaVersion> |
|
||||||
<ProjectGuid>{a7e6c2fe-6933-44a2-a420-aa6a38d421e9}</ProjectGuid> |
|
||||||
<OutputType>Library</OutputType> |
|
||||||
<RootNamespace>FSharpBinding</RootNamespace> |
|
||||||
<AssemblyName>FSharpBinding</AssemblyName> |
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
|
||||||
<FileAlignment>512</FileAlignment> |
|
||||||
<Name>FSharpBinding</Name> |
|
||||||
<OutputPath>..\..\..\..\..\..\AddIns\AddIns\BackendBindings\FSharpBinding</OutputPath> |
|
||||||
</PropertyGroup> |
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |
|
||||||
<DebugSymbols>true</DebugSymbols> |
|
||||||
<DebugType>full</DebugType> |
|
||||||
<Optimize>false</Optimize> |
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
|
||||||
<ErrorReport>prompt</ErrorReport> |
|
||||||
<WarningLevel>3</WarningLevel> |
|
||||||
<OtherFlags></OtherFlags> |
|
||||||
</PropertyGroup> |
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |
|
||||||
<DebugType>pdbonly</DebugType> |
|
||||||
<Optimize>true</Optimize> |
|
||||||
<DefineConstants>TRACE</DefineConstants> |
|
||||||
<ErrorReport>prompt</ErrorReport> |
|
||||||
<WarningLevel>3</WarningLevel> |
|
||||||
<OtherFlags>--standalone</OtherFlags> |
|
||||||
</PropertyGroup> |
|
||||||
<ItemGroup> |
|
||||||
<Compile Include="Src\project.fs" /> |
|
||||||
<Compile Include="Src\languagebinding.fs" /> |
|
||||||
<Compile Include="Src\fsi.fs" /> |
|
||||||
<EmbeddedResource Include="Resources\FS-Mode.xshd" /> |
|
||||||
<EmbeddedResource Include="Resources\FsOptions.xfrm" /> |
|
||||||
<None Include="FSharpBinding.addin"> |
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
|
||||||
</None> |
|
||||||
<None Include="Templates\ConsoleProject.xpt"> |
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
|
||||||
</None> |
|
||||||
<None Include="Templates\EmptyClass.xft"> |
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
|
||||||
</None> |
|
||||||
</ItemGroup> |
|
||||||
<ItemGroup> |
|
||||||
<Reference Include="log4net"> |
|
||||||
<HintPath>..\..\..\..\..\Libraries\log4net\log4net.dll</HintPath> |
|
||||||
<Private>False</Private> |
|
||||||
</Reference> |
|
||||||
<Reference Include="Mono.Cecil"> |
|
||||||
<HintPath>..\..\..\..\..\Libraries\Mono.Cecil\Mono.Cecil.dll</HintPath> |
|
||||||
<Private>False</Private> |
|
||||||
</Reference> |
|
||||||
<Reference Include="PresentationCore"> |
|
||||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
|
||||||
</Reference> |
|
||||||
<Reference Include="PresentationFramework"> |
|
||||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
|
||||||
</Reference> |
|
||||||
<Reference Include="PresentationUI"> |
|
||||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
|
||||||
</Reference> |
|
||||||
<Reference Include="Microsoft.Build"> |
|
||||||
<RequiredTargetFramework>4.0</RequiredTargetFramework> |
|
||||||
</Reference> |
|
||||||
<Reference Include="System" /> |
|
||||||
<Reference Include="System.Configuration" /> |
|
||||||
<Reference Include="System.Xml" /> |
|
||||||
<Reference Include="System.Drawing" /> |
|
||||||
<Reference Include="System.Windows.Forms" /> |
|
||||||
<Reference Include="WindowsBase"> |
|
||||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
|
||||||
</Reference> |
|
||||||
<ProjectReference Include="..\..\..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj"> |
|
||||||
<Name>ICSharpCode.Core.WinForms</Name> |
|
||||||
<Project>{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}</Project> |
|
||||||
<Private>False</Private> |
|
||||||
</ProjectReference> |
|
||||||
<ProjectReference Include="..\..\..\..\..\Libraries\NRefactory\Project\NRefactory.csproj"> |
|
||||||
<Name>NRefactory</Name> |
|
||||||
<Project>{3a9ae6aa-bc07-4a2f-972c-581e3ae2f195}</Project> |
|
||||||
<Private>False</Private> |
|
||||||
</ProjectReference> |
|
||||||
<ProjectReference Include="..\..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
|
||||||
<Name>ICSharpCode.SharpDevelop</Name> |
|
||||||
<Project>{2748ad25-9c63-4e12-877b-4dce96fbed54}</Project> |
|
||||||
<Private>False</Private> |
|
||||||
</ProjectReference> |
|
||||||
<ProjectReference Include="..\..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj"> |
|
||||||
<Name>ICSharpCode.Core</Name> |
|
||||||
<Project>{35cef10f-2d4c-45f2-9dd1-161e0fec583c}</Project> |
|
||||||
<Private>False</Private> |
|
||||||
</ProjectReference> |
|
||||||
<ProjectReference Include="..\..\..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj"> |
|
||||||
<Name>ICSharpCode.SharpDevelop.Dom</Name> |
|
||||||
<Project>{924ee450-603d-49c1-a8e5-4afaa31ce6f3}</Project> |
|
||||||
<Private>False</Private> |
|
||||||
</ProjectReference> |
|
||||||
<ProjectReference Include="..\..\..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj"> |
|
||||||
<Project>{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}</Project> |
|
||||||
<Name>ICSharpCode.Core.Presentation</Name> |
|
||||||
<Private>False</Private> |
|
||||||
</ProjectReference> |
|
||||||
</ItemGroup> |
|
||||||
<Target Name="Clean" Condition="!Exists('$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets')"> |
|
||||||
<!-- F# not found? no need to clean anything --> |
|
||||||
</Target> |
|
||||||
<Target Name="Build" Condition="!Exists('$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets')"> |
|
||||||
<Warning Text="Microsoft.FSharp.Targets not found, skipping F# binding" /> |
|
||||||
</Target> |
|
||||||
<Target Name="Rebuild" Condition="!Exists('$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets')"> |
|
||||||
<Warning Text="Microsoft.FSharp.Targets not found, skipping F# binding" /> |
|
||||||
</Target> |
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets" Condition="Exists('$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets')" /> |
|
||||||
</Project> |
|
@ -1,144 +0,0 @@ |
|||||||
// <file> |
|
||||||
// <copyright see="prj:///doc/copyright.txt"/> |
|
||||||
// <license see="prj:///doc/license.txt"/> |
|
||||||
// <owner name="Robert Pickering" email="robert@strangelights.com"/> |
|
||||||
// <version>$Revision$</version> |
|
||||||
// </file> |
|
||||||
|
|
||||||
#light |
|
||||||
namespace FSharpBinding |
|
||||||
|
|
||||||
open System |
|
||||||
open System.IO |
|
||||||
open System.Configuration |
|
||||||
open System.Collections.Generic |
|
||||||
open System.Diagnostics |
|
||||||
open System.Windows.Forms |
|
||||||
open System.Xml |
|
||||||
open ICSharpCode.SharpDevelop.Dom |
|
||||||
open ICSharpCode.SharpDevelop.Dom.CSharp |
|
||||||
open ICSharpCode.SharpDevelop.Internal.Templates |
|
||||||
open ICSharpCode.SharpDevelop.Project |
|
||||||
open ICSharpCode.Core |
|
||||||
open ICSharpCode.SharpDevelop.Gui |
|
||||||
open ICSharpCode.SharpDevelop.Editor |
|
||||||
|
|
||||||
module TheControl = |
|
||||||
let outputQueue = new Queue<string>() |
|
||||||
let errorQueue = new Queue<string>() |
|
||||||
let fsiProcess = new Process() |
|
||||||
let panel = new Panel() |
|
||||||
let input = new TextBox(Anchor = (AnchorStyles.Left ||| AnchorStyles.Top ||| AnchorStyles.Right), |
|
||||||
Width = panel.Width) |
|
||||||
let output = new TextBox(Multiline = true, |
|
||||||
Top = input.Height, |
|
||||||
Height = panel.Height - input.Height, |
|
||||||
Width = panel.Width, |
|
||||||
ReadOnly = true, |
|
||||||
ScrollBars = ScrollBars.Both, |
|
||||||
WordWrap = false, |
|
||||||
Anchor = (AnchorStyles.Left ||| AnchorStyles.Top ||| AnchorStyles.Right ||| AnchorStyles.Bottom)) |
|
||||||
panel.Controls.Add(input) |
|
||||||
panel.Controls.Add(output) |
|
||||||
let foundCompiler = |
|
||||||
if ConfigurationManager.AppSettings.AllKeys |> Array.exists (fun x -> x = "alt_fs_bin_path") then |
|
||||||
let path = Path.Combine(ConfigurationManager.AppSettings.get_Item("alt_fs_bin_path"), "fsi.exe") |
|
||||||
if File.Exists(path) then |
|
||||||
fsiProcess.StartInfo.FileName <- path |
|
||||||
true |
|
||||||
else |
|
||||||
output.Text <- |
|
||||||
"you are trying to use the app setting alt_fs_bin_path, but fsi.exe is not localed in the given directory" |
|
||||||
false |
|
||||||
else |
|
||||||
let path = Environment.GetEnvironmentVariable("PATH") |
|
||||||
let paths = path.Split([|';'|]) |
|
||||||
let path = paths |> Array.tryFind (fun x -> try File.Exists(Path.Combine(x, "fsi.exe")) with _ -> false) |
|
||||||
match path with |
|
||||||
| Some x -> |
|
||||||
fsiProcess.StartInfo.FileName <- Path.Combine(x, "fsi.exe") |
|
||||||
true |
|
||||||
| None -> |
|
||||||
let programFiles = Environment.GetEnvironmentVariable("ProgramFiles") |
|
||||||
let fsdirs = Directory.GetDirectories(programFiles, "FSharp*") |
|
||||||
let possibleFiles = |
|
||||||
fsdirs |> Array.choose |
|
||||||
(fun x -> |
|
||||||
LoggingService.Debug("Trying to find fsi in '" + x + "'") |
|
||||||
let fileInfo = new FileInfo(Path.Combine(x, "bin\\fsi.exe")) |
|
||||||
if fileInfo.Exists then |
|
||||||
Some fileInfo |
|
||||||
else |
|
||||||
None) |
|
||||||
let possibleFiles = possibleFiles |> Array.sortBy (fun x -> x.CreationTime) |
|
||||||
if possibleFiles.Length > 0 then |
|
||||||
fsiProcess.StartInfo.FileName <- possibleFiles.[0].FullName |
|
||||||
true |
|
||||||
else |
|
||||||
output.Text <- |
|
||||||
"Can not find the fsi.exe, ensure a version of the F# compiler is installed." + Environment.NewLine + |
|
||||||
"Please see http://research.microsoft.com/fsharp for details of how to install the compiler" |
|
||||||
false |
|
||||||
if foundCompiler then |
|
||||||
input.KeyUp.Add(fun ea -> |
|
||||||
if ea.KeyData = Keys.Return then |
|
||||||
fsiProcess.StandardInput.WriteLine(input.Text) |
|
||||||
input.Text <- "" ) |
|
||||||
//fsiProcess.StartInfo.Arguments <- "--fsi-server sharpdevelopfsi" |
|
||||||
fsiProcess.StartInfo.UseShellExecute <- false |
|
||||||
fsiProcess.StartInfo.CreateNoWindow <- true |
|
||||||
fsiProcess.StartInfo.RedirectStandardError <- true |
|
||||||
fsiProcess.StartInfo.RedirectStandardInput <- true |
|
||||||
fsiProcess.StartInfo.RedirectStandardOutput <- true |
|
||||||
fsiProcess.ErrorDataReceived.Add(fun ea -> lock errorQueue (fun () -> errorQueue.Enqueue(ea.Data)) ) |
|
||||||
fsiProcess.OutputDataReceived.Add(fun ea -> lock outputQueue (fun () -> outputQueue.Enqueue(ea.Data)) ) |
|
||||||
fsiProcess.Exited.Add(fun ea -> |
|
||||||
output.AppendText("fsi.exe died" + Environment.NewLine) |
|
||||||
output.AppendText("restarting ..." + Environment.NewLine) |
|
||||||
fsiProcess.Start() |> ignore) |
|
||||||
fsiProcess.Start() |> ignore |
|
||||||
fsiProcess.BeginErrorReadLine() |
|
||||||
fsiProcess.BeginOutputReadLine() |
|
||||||
let timer = new Timer(Interval = 1000) |
|
||||||
let readAll (q : Queue<string>) = |
|
||||||
while q.Count > 0 do |
|
||||||
output.AppendText(q.Dequeue() + Environment.NewLine) |
|
||||||
timer.Tick.Add(fun _ -> |
|
||||||
lock errorQueue (fun () -> readAll errorQueue) |
|
||||||
lock outputQueue (fun () -> readAll outputQueue)) |
|
||||||
timer.Start() |
|
||||||
else |
|
||||||
input.KeyUp.Add(fun ea -> |
|
||||||
if ea.KeyData = Keys.Return then |
|
||||||
output.Text <- |
|
||||||
(output.Text + Environment.NewLine + |
|
||||||
"F# not installed - could not execute command") |
|
||||||
input.Text <- "" ) |
|
||||||
|
|
||||||
type FSharpInteractive = class |
|
||||||
inherit AbstractPadContent |
|
||||||
new() = {} |
|
||||||
override x.Control |
|
||||||
with get() = TheControl.panel :> Object |
|
||||||
end |
|
||||||
|
|
||||||
type SentToFSharpInteractive = class |
|
||||||
inherit AbstractMenuCommand |
|
||||||
new () = {} |
|
||||||
override x.Run() = |
|
||||||
if TheControl.foundCompiler then |
|
||||||
let window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow |
|
||||||
if window <> null then |
|
||||||
match window.ActiveViewContent :> obj with |
|
||||||
| :? ITextEditorProvider as textEditorProvider -> |
|
||||||
let textEditor = textEditorProvider.TextEditor |
|
||||||
let pad = WorkbenchSingleton.Workbench.GetPad(typeof<FSharpInteractive>) |
|
||||||
pad.BringPadToFront() |
|
||||||
if textEditor.SelectionLength > 0 then |
|
||||||
TheControl.fsiProcess.StandardInput.WriteLine(textEditor.SelectedText) |
|
||||||
else |
|
||||||
let line = textEditor.Document.GetLine(textEditor.Caret.Line) |
|
||||||
TheControl.fsiProcess.StandardInput.WriteLine(line.Text) |
|
||||||
TheControl.fsiProcess.StandardInput.WriteLine(";;") |
|
||||||
| _ -> () |
|
||||||
end |
|
@ -1,25 +0,0 @@ |
|||||||
// <file> |
|
||||||
// <copyright see="prj:///doc/copyright.txt"/> |
|
||||||
// <license see="prj:///doc/license.txt"/> |
|
||||||
// <owner name="Robert Pickering" email="robert@strangelights.com"/> |
|
||||||
// <version>$Revision$</version> |
|
||||||
// </file> |
|
||||||
|
|
||||||
#light |
|
||||||
namespace FSharpBinding |
|
||||||
open System |
|
||||||
open System.Xml |
|
||||||
open ICSharpCode.SharpDevelop.Internal.Templates |
|
||||||
open ICSharpCode.SharpDevelop.Project |
|
||||||
open FSharpBinding |
|
||||||
|
|
||||||
type FSharpProjectBinding() = class |
|
||||||
interface IProjectBinding with |
|
||||||
member x.Language |
|
||||||
with get () = "F#" |
|
||||||
member x.LoadProject(info : ProjectLoadInformation) = |
|
||||||
new FSharpProject(info) :> IProject |
|
||||||
member c.CreateProject(info : ProjectCreateInformation) = |
|
||||||
new FSharpProject(info) :> IProject |
|
||||||
end |
|
||||||
end |
|
@ -1,229 +0,0 @@ |
|||||||
// <file> |
|
||||||
// <copyright see="prj:///doc/copyright.txt"/> |
|
||||||
// <license see="prj:///doc/license.txt"/> |
|
||||||
// <owner name="Robert Pickering" email="robert@strangelights.com"/> |
|
||||||
// <version>$Revision$</version> |
|
||||||
// </file> |
|
||||||
|
|
||||||
#light |
|
||||||
namespace FSharpBinding |
|
||||||
|
|
||||||
//Global todos |
|
||||||
//TODO add "compiling" dialog to output the correct directory |
|
||||||
//TODO copy all config to the correct locations |
|
||||||
//TODO add directory structure |
|
||||||
|
|
||||||
open System |
|
||||||
open System.ComponentModel |
|
||||||
open System.Diagnostics |
|
||||||
open System.Collections.Generic |
|
||||||
open System.Windows.Forms |
|
||||||
open System.IO |
|
||||||
open System.Xml |
|
||||||
|
|
||||||
open ICSharpCode.SharpDevelop.Dom |
|
||||||
open ICSharpCode.SharpDevelop.Dom.CSharp |
|
||||||
open ICSharpCode.SharpDevelop.Internal.Templates |
|
||||||
open ICSharpCode.SharpDevelop.Project |
|
||||||
open ICSharpCode.Core |
|
||||||
open ICSharpCode.SharpDevelop.Gui |
|
||||||
open ICSharpCode.SharpDevelop.Gui.OptionPanels |
|
||||||
|
|
||||||
type FSharpProject = class |
|
||||||
inherit CompilableProject |
|
||||||
new (info : ProjectLoadInformation) = |
|
||||||
{ inherit CompilableProject(info ) } |
|
||||||
new (info : ProjectCreateInformation) = |
|
||||||
{ inherit CompilableProject(info) } then |
|
||||||
try |
|
||||||
base.AddImport(@"$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets", null) |
|
||||||
base.ReevaluateIfNecessary() // provoke exception if import is invalid |
|
||||||
with |
|
||||||
| :? Microsoft.Build.Exceptions.InvalidProjectFileException as ex -> |
|
||||||
raise (ProjectLoadException("Please ensure that the F# compiler is installed on your computer.\n\n" + ex.Message, ex)) |
|
||||||
override x.GetDefaultItemType(fileName : string) = |
|
||||||
if String.Equals(".fs", Path.GetExtension(fileName), StringComparison.InvariantCultureIgnoreCase) then |
|
||||||
ItemType.Compile |
|
||||||
else if String.Equals(".fsi", Path.GetExtension(fileName), StringComparison.InvariantCultureIgnoreCase) then |
|
||||||
ItemType.Compile |
|
||||||
else |
|
||||||
base.GetDefaultItemType(fileName) |
|
||||||
override x.Language |
|
||||||
with get() = "F#" |
|
||||||
override x.LanguageProperties |
|
||||||
with get() = LanguageProperties.None |
|
||||||
end |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type FSharpProjectNode = class |
|
||||||
inherit ProjectNode |
|
||||||
new (project : IProject) = |
|
||||||
{ inherit ProjectNode(project) } |
|
||||||
member x.AddParentFolder((virtualName : string), (relativeDirectoryPath : string), (directoryNodeList :Dictionary<string, DirectoryNode>)) = |
|
||||||
if (relativeDirectoryPath.Length = 0 |
|
||||||
|| String.Compare(virtualName, 0, relativeDirectoryPath, 0, relativeDirectoryPath.Length, StringComparison.InvariantCultureIgnoreCase) = 0) then |
|
||||||
let pos = virtualName.IndexOf('/', relativeDirectoryPath.Length + 1) |
|
||||||
if (pos > 0) then |
|
||||||
let subFolderName = virtualName.Substring(relativeDirectoryPath.Length, pos - relativeDirectoryPath.Length); |
|
||||||
let res,node = directoryNodeList.TryGetValue(subFolderName) |
|
||||||
if (res) then |
|
||||||
if (node.FileNodeStatus = FileNodeStatus.None) then |
|
||||||
node.FileNodeStatus <- FileNodeStatus.InProject |
|
||||||
else |
|
||||||
let node = new DirectoryNode(Path.Combine(x.Directory, subFolderName), FileNodeStatus.Missing); |
|
||||||
node.AddTo(x) |
|
||||||
directoryNodeList.[subFolderName] <- node |
|
||||||
override x.Initialize() = |
|
||||||
//Debugger.Break() |
|
||||||
let fileNodeDictionary |
|
||||||
= new Dictionary<string, FileNode>(StringComparer.InvariantCultureIgnoreCase) |
|
||||||
let directoryNodeList = new Dictionary<string, DirectoryNode>(StringComparer.InvariantCultureIgnoreCase) |
|
||||||
|
|
||||||
let relativeDirectoryPath = |
|
||||||
if (x.RelativePath.Length > 0) then |
|
||||||
(x.RelativePath.Replace('\\', '/')) + "/" |
|
||||||
else |
|
||||||
String.Empty |
|
||||||
|
|
||||||
for item in x.Project.Items do |
|
||||||
match item with |
|
||||||
| :? FileProjectItem as item -> |
|
||||||
let virtualName = item.VirtualName.Replace('\\', '/') |
|
||||||
let virtualName = |
|
||||||
if (virtualName.EndsWith("/")) then |
|
||||||
virtualName.Substring(0, virtualName.Length - 1) |
|
||||||
else |
|
||||||
virtualName |
|
||||||
let fileName = Path.GetFileName(virtualName) |
|
||||||
if (not (String.Equals(virtualName, relativeDirectoryPath + fileName, StringComparison.InvariantCultureIgnoreCase))) then |
|
||||||
x.AddParentFolder(virtualName, relativeDirectoryPath, directoryNodeList); |
|
||||||
//continue; |
|
||||||
|
|
||||||
if (item.ItemType = ItemType.Folder || item.ItemType = ItemType.WebReferences) then |
|
||||||
let newDirectoryNode = DirectoryNodeFactory.CreateDirectoryNode(x, x.Project, fileName) |
|
||||||
if not (Directory.Exists(item.FileName)) then |
|
||||||
newDirectoryNode.FileNodeStatus <- FileNodeStatus.Missing |
|
||||||
newDirectoryNode.ProjectItem <- item |
|
||||||
newDirectoryNode.AddTo(x) |
|
||||||
directoryNodeList.[fileName] <- newDirectoryNode |
|
||||||
else |
|
||||||
let fileNode = new FileNode(item.FileName) |
|
||||||
if not (File.Exists(item.FileName)) then |
|
||||||
fileNode.FileNodeStatus <- FileNodeStatus.Missing |
|
||||||
fileNode.ProjectItem <- item |
|
||||||
fileNodeDictionary.[fileName] <- fileNode |
|
||||||
fileNode.AddTo(x) |
|
||||||
| _ -> () |
|
||||||
|
|
||||||
// Add files found in file system |
|
||||||
if (System.IO.Directory.Exists(x.Directory)) then |
|
||||||
for subDirectory in System.IO.Directory.GetDirectories(x.Directory) do |
|
||||||
let filename = Path.GetFileName(subDirectory) |
|
||||||
if (filename <> ".svn") then |
|
||||||
let res, node = directoryNodeList.TryGetValue(filename) |
|
||||||
if res then |
|
||||||
if (node.FileNodeStatus = FileNodeStatus.None) then |
|
||||||
node.FileNodeStatus <- FileNodeStatus.InProject; |
|
||||||
else |
|
||||||
let node = DirectoryNodeFactory.CreateDirectoryNode(x, x.Project, subDirectory) |
|
||||||
node.AddTo(x) |
|
||||||
|
|
||||||
for fullpath in System.IO.Directory.GetFiles(x.Directory) do |
|
||||||
let file = Path.GetFileName(fullpath) |
|
||||||
let res, node = fileNodeDictionary.TryGetValue(file) |
|
||||||
if res then |
|
||||||
if (node.FileNodeStatus = FileNodeStatus.None) then |
|
||||||
node.FileNodeStatus <- FileNodeStatus.InProject |
|
||||||
else |
|
||||||
let node = new FileNode(file) |
|
||||||
node.AddTo(x) |
|
||||||
|
|
||||||
end |
|
||||||
|
|
||||||
type FSharpProjectNodeBuilder() = class |
|
||||||
interface IProjectNodeBuilder with |
|
||||||
member x.CanBuildProjectTree(project : IProject) = |
|
||||||
project :? FSharpProject |
|
||||||
member x.AddProjectNode(solution : TreeNode, project : IProject) = |
|
||||||
let prjNode = new FSharpProjectNode(project) |
|
||||||
prjNode.AddTo(solution) |
|
||||||
|
|
||||||
let referenceFolderNode = new ReferenceFolder(project) |
|
||||||
referenceFolderNode.AddTo(prjNode) |
|
||||||
|
|
||||||
prjNode :> TreeNode |
|
||||||
end |
|
||||||
end |
|
||||||
|
|
||||||
module ProjectHelpers = |
|
||||||
let forEachFileNode f (nodes : TreeNodeCollection) = |
|
||||||
for node in nodes do |
|
||||||
match node with |
|
||||||
| :? FileNode as fileNode -> |
|
||||||
if fileNode.ProjectItem <> null then |
|
||||||
f fileNode |
|
||||||
| _ -> () |
|
||||||
|
|
||||||
let reorderItems (nodes : TreeNodeCollection) (project : IProject) = |
|
||||||
//ProjectService.MarkProjectDirty(project) |
|
||||||
project.Save() |
|
||||||
let doc = new XmlDocument() |
|
||||||
doc.Load(project.FileName) |
|
||||||
let nsmgr = new XmlNamespaceManager(doc.NameTable) |
|
||||||
nsmgr.AddNamespace("proj", "http://schemas.microsoft.com/developer/msbuild/2003") |
|
||||||
let d = new Dictionary<FileNode,XmlNode>() |
|
||||||
nodes |> forEachFileNode |
|
||||||
(fun node -> |
|
||||||
let docNode = doc.SelectSingleNode(Printf.sprintf @"//proj:Compile[@Include=""%s""]" (Path.GetFileName(node.FileName)), nsmgr) |
|
||||||
if docNode <> null then |
|
||||||
d.[node] <- docNode |
|
||||||
docNode.ParentNode.RemoveChild(docNode) |> ignore) |
|
||||||
let itemNode = doc.SelectSingleNode("//proj:ItemGroup", nsmgr) |
|
||||||
nodes |> forEachFileNode |
|
||||||
(fun node -> |
|
||||||
let found, xmlElem = d.TryGetValue(node) |
|
||||||
if found then |
|
||||||
itemNode.AppendChild(xmlElem) |> ignore) |
|
||||||
doc.Save(project.FileName) |
|
||||||
|
|
||||||
|
|
||||||
type MoveUpFileEvent() = |
|
||||||
inherit AbstractMenuCommand() |
|
||||||
override x.Run() = |
|
||||||
let node = ProjectBrowserPad.Instance.SelectedNode |
|
||||||
match node with |
|
||||||
| :? FileNode as fileNode -> |
|
||||||
let parent = node.Parent |
|
||||||
let nodeIndex = parent.Nodes.IndexOf(node) |
|
||||||
if nodeIndex > 1 then |
|
||||||
parent.Nodes.Remove(node) |
|
||||||
parent.Nodes.Insert(nodeIndex - 1, node) |
|
||||||
ProjectHelpers.reorderItems parent.Nodes fileNode.Project |
|
||||||
| _ -> () |
|
||||||
|
|
||||||
|
|
||||||
type MoveDownFileEvent() = |
|
||||||
inherit AbstractMenuCommand() |
|
||||||
override x.Run() = |
|
||||||
let node = ProjectBrowserPad.Instance.SelectedNode |
|
||||||
match node with |
|
||||||
| :? FileNode as fileNode -> |
|
||||||
let parent = node.Parent |
|
||||||
let nodeIndex = parent.Nodes.IndexOf(node) |
|
||||||
if nodeIndex < parent.Nodes.Count then |
|
||||||
parent.Nodes.Remove(node) |
|
||||||
parent.Nodes.Insert(nodeIndex + 1, node) |
|
||||||
ProjectHelpers.reorderItems parent.Nodes fileNode.Project |
|
||||||
| _ -> () |
|
||||||
|
|
||||||
|
|
||||||
type FsOptions() = |
|
||||||
inherit AbstractXmlFormsProjectOptionPanel() |
|
||||||
override x.LoadPanelContents() = |
|
||||||
let this = (typeof<FsOptions>) |
|
||||||
let caller = this.Assembly |
|
||||||
x.SetupFromXmlStream(caller.GetManifestResourceStream("FsOptions.xfrm")) |
|
||||||
x.InitializeHelper() |
|
||||||
x.helper.BindBoolean(x.Get<CheckBox>("standalone"), "Standalone", false) |> ignore |
|
||||||
x.helper.BindBoolean(x.Get<CheckBox>("nomllib"), "NoMLLib", false) |> ignore |
|
@ -0,0 +1,99 @@ |
|||||||
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<PropertyGroup> |
||||||
|
<ProjectGuid>{E954F3CB-A446-492F-A664-2B376EBC86E8}</ProjectGuid> |
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||||
|
<OutputType>Library</OutputType> |
||||||
|
<RootNamespace>FSharpBinding</RootNamespace> |
||||||
|
<AssemblyName>FSharpBinding</AssemblyName> |
||||||
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> |
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder> |
||||||
|
<SourceAnalysisOverrideSettingsFile>C:\Users\Daniel\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile> |
||||||
|
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||||
|
<NoStdLib>False</NoStdLib> |
||||||
|
<WarningLevel>4</WarningLevel> |
||||||
|
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||||
|
<OutputPath>..\..\..\..\AddIns\AddIns\BackendBindings\FSharpBinding\</OutputPath> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||||
|
<PlatformTarget>AnyCPU</PlatformTarget> |
||||||
|
<RegisterForComInterop>False</RegisterForComInterop> |
||||||
|
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||||
|
<BaseAddress>4194304</BaseAddress> |
||||||
|
<FileAlignment>4096</FileAlignment> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||||
|
<DebugSymbols>true</DebugSymbols> |
||||||
|
<DebugType>Full</DebugType> |
||||||
|
<Optimize>False</Optimize> |
||||||
|
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||||
|
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||||
|
</PropertyGroup> |
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||||
|
<DebugSymbols>False</DebugSymbols> |
||||||
|
<DebugType>None</DebugType> |
||||||
|
<Optimize>True</Optimize> |
||||||
|
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||||
|
<DefineConstants>TRACE</DefineConstants> |
||||||
|
</PropertyGroup> |
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||||
|
<ItemGroup> |
||||||
|
<Reference Include="Microsoft.Build" /> |
||||||
|
<Reference Include="System" /> |
||||||
|
<Reference Include="System.Configuration" /> |
||||||
|
<Reference Include="System.Core"> |
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||||
|
</Reference> |
||||||
|
<Reference Include="System.Windows.Forms" /> |
||||||
|
<Reference Include="System.Xml" /> |
||||||
|
<Reference Include="System.Xml.Linq"> |
||||||
|
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||||
|
</Reference> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<Compile Include="..\..\..\Main\GlobalAssemblyInfo.cs"> |
||||||
|
<Link>Properties\GlobalAssemblyInfo.cs</Link> |
||||||
|
</Compile> |
||||||
|
<Compile Include="FSharpInteractive.cs" /> |
||||||
|
<Compile Include="FSharpLanguageBinding.cs" /> |
||||||
|
<Compile Include="FSharpProject.cs" /> |
||||||
|
<Compile Include="FSharpProjectNode.cs" /> |
||||||
|
<Compile Include="FSharpProjectNodeBuilder.cs" /> |
||||||
|
<Compile Include="FsOptions.cs" /> |
||||||
|
<Compile Include="ProjectHelpers.cs" /> |
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" /> |
||||||
|
<EmbeddedResource Include="Resources\FS-Mode.xshd" /> |
||||||
|
<EmbeddedResource Include="Resources\FsOptions.xfrm" /> |
||||||
|
<None Include="FSharpBinding.addin"> |
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<None Include="Templates\ConsoleProject.xpt"> |
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
<None Include="Templates\EmptyClass.xft"> |
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||||
|
</None> |
||||||
|
</ItemGroup> |
||||||
|
<ItemGroup> |
||||||
|
<ProjectReference Include="..\..\..\Libraries\ICSharpCode.TextEditor\Project\ICSharpCode.TextEditor.csproj"> |
||||||
|
<Project>{2D18BE89-D210-49EB-A9DD-2246FBB3DF6D}</Project> |
||||||
|
<Name>ICSharpCode.TextEditor</Name> |
||||||
|
<Private>False</Private> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
||||||
|
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> |
||||||
|
<Name>ICSharpCode.SharpDevelop</Name> |
||||||
|
<Private>False</Private> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\..\..\Main\Core\Project\ICSharpCode.Core.csproj"> |
||||||
|
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> |
||||||
|
<Name>ICSharpCode.Core</Name> |
||||||
|
<Private>False</Private> |
||||||
|
</ProjectReference> |
||||||
|
<ProjectReference Include="..\..\..\Main\ICSharpCode.SharpDevelop.Dom\Project\ICSharpCode.SharpDevelop.Dom.csproj"> |
||||||
|
<Project>{924EE450-603D-49C1-A8E5-4AFAA31CE6F3}</Project> |
||||||
|
<Name>ICSharpCode.SharpDevelop.Dom</Name> |
||||||
|
<Private>False</Private> |
||||||
|
</ProjectReference> |
||||||
|
</ItemGroup> |
||||||
|
</Project> |
@ -0,0 +1,170 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <author name="Daniel Grunwald"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using ICSharpCode.SharpDevelop.Editor; |
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Configuration; |
||||||
|
using System.Diagnostics; |
||||||
|
using System.IO; |
||||||
|
using System.Linq; |
||||||
|
using System.Windows.Forms; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using ICSharpCode.SharpDevelop.Gui; |
||||||
|
|
||||||
|
namespace FSharpBinding |
||||||
|
{ |
||||||
|
public class FSharpInteractive : AbstractPadContent |
||||||
|
{ |
||||||
|
Queue<string> outputQueue = new Queue<string>(); |
||||||
|
internal readonly Process fsiProcess = new Process(); |
||||||
|
Panel panel = new Panel(); |
||||||
|
TextBox input, output; |
||||||
|
internal readonly bool foundCompiler; |
||||||
|
|
||||||
|
public FSharpInteractive() |
||||||
|
{ |
||||||
|
input = new TextBox { |
||||||
|
Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right, |
||||||
|
Width = panel.Width |
||||||
|
}; |
||||||
|
output = new TextBox { |
||||||
|
Multiline = true, |
||||||
|
Top = input.Height, |
||||||
|
Height = panel.Height - input.Height, |
||||||
|
Width = panel.Width, |
||||||
|
ReadOnly = true, |
||||||
|
ScrollBars = ScrollBars.Both, |
||||||
|
WordWrap = false, |
||||||
|
Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom |
||||||
|
}; |
||||||
|
panel.Controls.Add(input); |
||||||
|
panel.Controls.Add(output); |
||||||
|
|
||||||
|
if (Array.Exists(ConfigurationManager.AppSettings.AllKeys, x => x == "alt_fs_bin_path")) { |
||||||
|
string path = Path.Combine(ConfigurationManager.AppSettings["alt_fs_bin_path"], "fsi.exe"); |
||||||
|
if (File.Exists(path)) { |
||||||
|
fsiProcess.StartInfo.FileName = path; |
||||||
|
foundCompiler = true; |
||||||
|
} else { |
||||||
|
output.Text = "you are trying to use the app setting alt_fs_bin_path, but fsi.exe is not localed in the given directory"; |
||||||
|
foundCompiler = false; |
||||||
|
} |
||||||
|
} else { |
||||||
|
string[] paths = Environment.GetEnvironmentVariable("PATH").Split(';'); |
||||||
|
string path = Array.Find(paths, x => { |
||||||
|
try { |
||||||
|
return File.Exists(Path.Combine(x, "fsi.exe")); |
||||||
|
} catch { |
||||||
|
return false; |
||||||
|
}}); |
||||||
|
if (path != null) { |
||||||
|
fsiProcess.StartInfo.FileName = Path.Combine(path, "fsi.exe"); |
||||||
|
foundCompiler = true; |
||||||
|
} else { |
||||||
|
string programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); |
||||||
|
var possibleFiles = from fsdir in Directory.GetDirectories(programFiles, "FSharp*") |
||||||
|
//LoggingService.Debug("Trying to find fsi in '" + fsdir + "'");
|
||||||
|
let fileInfo = new FileInfo(Path.Combine(fsdir, "bin\\fsi.exe")) |
||||||
|
where fileInfo.Exists |
||||||
|
orderby fileInfo.CreationTime |
||||||
|
select fileInfo; |
||||||
|
FileInfo file = possibleFiles.FirstOrDefault(); |
||||||
|
if (file != null) { |
||||||
|
fsiProcess.StartInfo.FileName = file.FullName; |
||||||
|
foundCompiler = true; |
||||||
|
} else { |
||||||
|
output.Text = "Can not find the fsi.exe, ensure a version of the F# compiler is installed." + Environment.NewLine + |
||||||
|
"Please see http://research.microsoft.com/fsharp for details of how to install the compiler"; |
||||||
|
foundCompiler = false; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (foundCompiler) { |
||||||
|
input.KeyUp += delegate(object sender, KeyEventArgs e) { |
||||||
|
if (e.KeyData == Keys.Return) { |
||||||
|
fsiProcess.StandardInput.WriteLine(input.Text); |
||||||
|
input.Text = ""; |
||||||
|
} |
||||||
|
}; |
||||||
|
//fsiProcess.StartInfo.Arguments <- "--fsi-server sharpdevelopfsi";
|
||||||
|
fsiProcess.StartInfo.UseShellExecute = false; |
||||||
|
fsiProcess.StartInfo.CreateNoWindow = true; |
||||||
|
fsiProcess.StartInfo.RedirectStandardError = true; |
||||||
|
fsiProcess.StartInfo.RedirectStandardInput = true; |
||||||
|
fsiProcess.StartInfo.RedirectStandardOutput = true; |
||||||
|
fsiProcess.ErrorDataReceived += delegate(object sender, DataReceivedEventArgs e) { |
||||||
|
lock (outputQueue) { |
||||||
|
outputQueue.Enqueue(e.Data); |
||||||
|
} |
||||||
|
WorkbenchSingleton.SafeThreadAsyncCall(ReadAll); |
||||||
|
}; |
||||||
|
fsiProcess.OutputDataReceived += delegate(object sender, DataReceivedEventArgs e) { |
||||||
|
lock (outputQueue) { |
||||||
|
outputQueue.Enqueue(e.Data); |
||||||
|
} |
||||||
|
WorkbenchSingleton.SafeThreadAsyncCall(ReadAll); |
||||||
|
}; |
||||||
|
fsiProcess.Exited += delegate(object sender, EventArgs e) { |
||||||
|
lock (outputQueue) { |
||||||
|
outputQueue.Enqueue("fsi.exe died"); |
||||||
|
outputQueue.Enqueue("restarting ..."); |
||||||
|
} |
||||||
|
WorkbenchSingleton.SafeThreadAsyncCall(ReadAll); |
||||||
|
fsiProcess.Start(); |
||||||
|
}; |
||||||
|
fsiProcess.Start(); |
||||||
|
fsiProcess.BeginErrorReadLine(); |
||||||
|
fsiProcess.BeginOutputReadLine(); |
||||||
|
} else { |
||||||
|
input.KeyUp += delegate(object sender, KeyEventArgs e) { |
||||||
|
if (e.KeyData == Keys.Return) { |
||||||
|
output.AppendText(Environment.NewLine + "F# not installed - could not execute command"); |
||||||
|
input.Text = ""; |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void ReadAll() |
||||||
|
{ |
||||||
|
lock (outputQueue) { |
||||||
|
while (outputQueue.Count > 0) |
||||||
|
output.AppendText(outputQueue.Dequeue() + Environment.NewLine); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override object Control { |
||||||
|
get { return panel; } |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public class SentToFSharpInteractive : AbstractMenuCommand |
||||||
|
{ |
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
PadDescriptor pad = WorkbenchSingleton.Workbench.GetPad(typeof(FSharpInteractive)); |
||||||
|
pad.BringPadToFront(); |
||||||
|
FSharpInteractive fsharpInteractive = (FSharpInteractive)pad.PadContent; |
||||||
|
if (fsharpInteractive.foundCompiler) { |
||||||
|
ITextEditorProvider editorProvider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorProvider; |
||||||
|
if (editorProvider != null) { |
||||||
|
var textEditor = editorProvider.TextEditor; |
||||||
|
if (textEditor.SelectionLength > 0) { |
||||||
|
fsharpInteractive.fsiProcess.StandardInput.WriteLine(textEditor.SelectedText); |
||||||
|
} else { |
||||||
|
var line = textEditor.Document.GetLine(textEditor.Caret.Line); |
||||||
|
fsharpInteractive.fsiProcess.StandardInput.WriteLine(line.Text); |
||||||
|
} |
||||||
|
fsharpInteractive.fsiProcess.StandardInput.WriteLine(";;"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <author name="Daniel Grunwald"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
using System; |
||||||
|
|
||||||
|
namespace FSharpBinding |
||||||
|
{ |
||||||
|
public class FSharpProjectBinding : IProjectBinding |
||||||
|
{ |
||||||
|
public string Language { |
||||||
|
get { return "F#"; } |
||||||
|
} |
||||||
|
|
||||||
|
public IProject LoadProject(ProjectLoadInformation info) |
||||||
|
{ |
||||||
|
return new FSharpProject(info); |
||||||
|
} |
||||||
|
|
||||||
|
public IProject CreateProject(ICSharpCode.SharpDevelop.Internal.Templates.ProjectCreateInformation info) |
||||||
|
{ |
||||||
|
return new FSharpProject(info); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,61 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <author name="Daniel Grunwald"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using ICSharpCode.SharpDevelop.Dom; |
||||||
|
using ICSharpCode.SharpDevelop.Internal.Templates; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
using Microsoft.Build.Exceptions; |
||||||
|
using System.IO; |
||||||
|
|
||||||
|
namespace FSharpBinding |
||||||
|
{ |
||||||
|
//Global todos
|
||||||
|
//TODO add "compiling" dialog to output the correct directory
|
||||||
|
//TODO copy all config to the correct locations
|
||||||
|
//TODO add directory structure
|
||||||
|
|
||||||
|
public class FSharpProject : CompilableProject |
||||||
|
{ |
||||||
|
public FSharpProject(ProjectLoadInformation info) : base(info) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public FSharpProject(ProjectCreateInformation info) : base(info) |
||||||
|
{ |
||||||
|
try { |
||||||
|
base.AddImport(@"$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets", null); |
||||||
|
base.ReevaluateIfNecessary(); // provoke exception if import is invalid
|
||||||
|
} catch (InvalidProjectFileException ex) { |
||||||
|
throw new ProjectLoadException("Please ensure that the F# compiler is installed on your computer.\n\n" + ex.Message, ex); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override ItemType GetDefaultItemType(string fileName) |
||||||
|
{ |
||||||
|
if (string.Equals(".fs", Path.GetExtension(fileName), StringComparison.InvariantCultureIgnoreCase)) { |
||||||
|
return ItemType.Compile; |
||||||
|
} else if (string.Equals(".fsi", Path.GetExtension(fileName), StringComparison.InvariantCultureIgnoreCase)) { |
||||||
|
return ItemType.Compile; |
||||||
|
} else { |
||||||
|
return base.GetDefaultItemType(fileName); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override string Language { |
||||||
|
get { |
||||||
|
return "F#"; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override LanguageProperties LanguageProperties { |
||||||
|
get { |
||||||
|
return LanguageProperties.None; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,110 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <author name="Daniel Grunwald"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.IO; |
||||||
|
using System.Linq; |
||||||
|
|
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
|
||||||
|
namespace FSharpBinding |
||||||
|
{ |
||||||
|
public class FSharpProjectNode : ProjectNode |
||||||
|
{ |
||||||
|
public FSharpProjectNode(IProject project) : base(project) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public void AddParentFolder(string virtualName, string relativeDirectoryPath, Dictionary<string, DirectoryNode> directoryNodeList) |
||||||
|
{ |
||||||
|
if ((relativeDirectoryPath.Length == 0) |
||||||
|
|| (string.Compare(virtualName, 0, relativeDirectoryPath, 0, relativeDirectoryPath.Length, StringComparison.InvariantCultureIgnoreCase) == 0)) |
||||||
|
{ |
||||||
|
int pos = virtualName.IndexOf('/', relativeDirectoryPath.Length + 1); |
||||||
|
if (pos > 0) { |
||||||
|
string subFolderName = virtualName.Substring(relativeDirectoryPath.Length, pos - relativeDirectoryPath.Length); |
||||||
|
DirectoryNode node; |
||||||
|
if (directoryNodeList.TryGetValue(subFolderName, out node)) { |
||||||
|
if (node.FileNodeStatus == FileNodeStatus.None) { |
||||||
|
node.FileNodeStatus = FileNodeStatus.InProject; |
||||||
|
} |
||||||
|
} else { |
||||||
|
node = new DirectoryNode(Path.Combine(this.Directory, subFolderName), FileNodeStatus.Missing); |
||||||
|
node.AddTo(this); |
||||||
|
directoryNodeList[subFolderName] = node; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override void Initialize() |
||||||
|
{ |
||||||
|
Dictionary<string, FileNode> fileNodeDictionary = new Dictionary<string, FileNode>((IEqualityComparer<string>) StringComparer.InvariantCultureIgnoreCase); |
||||||
|
Dictionary<string, DirectoryNode> directoryNodeList = new Dictionary<string, DirectoryNode>((IEqualityComparer<string>) StringComparer.InvariantCultureIgnoreCase); |
||||||
|
string relativeDirectoryPath = (this.RelativePath.Length <= 0) ? string.Empty : (this.RelativePath.Replace('\\', '/') + "/"); |
||||||
|
|
||||||
|
foreach (FileProjectItem item in this.Project.Items.OfType<FileProjectItem>()) { |
||||||
|
string virtualName = item.VirtualName.Replace('\\', '/'); |
||||||
|
if (virtualName.EndsWith("/", StringComparison.Ordinal)) |
||||||
|
virtualName = virtualName.Substring(0, virtualName.Length - 1); |
||||||
|
string fileName = Path.GetFileName(virtualName); |
||||||
|
if (!string.Equals(virtualName, relativeDirectoryPath + fileName, StringComparison.InvariantCultureIgnoreCase)) { |
||||||
|
this.AddParentFolder(virtualName, relativeDirectoryPath, directoryNodeList); |
||||||
|
// continue;
|
||||||
|
} |
||||||
|
|
||||||
|
if (item.ItemType == ItemType.Folder || item.ItemType == ItemType.WebReferences) { |
||||||
|
DirectoryNode newDirectoryNode = DirectoryNodeFactory.CreateDirectoryNode(this, this.Project, fileName); |
||||||
|
if (!System.IO.Directory.Exists(item.FileName)) { |
||||||
|
newDirectoryNode.FileNodeStatus = FileNodeStatus.Missing; |
||||||
|
} |
||||||
|
newDirectoryNode.ProjectItem = item; |
||||||
|
newDirectoryNode.AddTo(this); |
||||||
|
directoryNodeList[fileName] = newDirectoryNode; |
||||||
|
} else { |
||||||
|
FileNode fileNode = new FileNode(item.FileName); |
||||||
|
if (!File.Exists(item.FileName)) { |
||||||
|
fileNode.FileNodeStatus = FileNodeStatus.Missing; |
||||||
|
} |
||||||
|
fileNode.ProjectItem = item; |
||||||
|
fileNodeDictionary[fileName] = fileNode; |
||||||
|
fileNode.AddTo(this); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// Add files found in file system
|
||||||
|
if (System.IO.Directory.Exists(this.Directory)) { |
||||||
|
foreach (string subDirectory in System.IO.Directory.GetDirectories(this.Directory)) { |
||||||
|
string filename = Path.GetFileName(subDirectory); |
||||||
|
if (filename != ".svn") { |
||||||
|
DirectoryNode node; |
||||||
|
if (directoryNodeList.TryGetValue(filename, out node)) { |
||||||
|
if (node.FileNodeStatus == FileNodeStatus.None) |
||||||
|
node.FileNodeStatus = FileNodeStatus.InProject; |
||||||
|
} else { |
||||||
|
node = DirectoryNodeFactory.CreateDirectoryNode(this, this.Project, subDirectory); |
||||||
|
node.AddTo(this); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
foreach (string fullpath in System.IO.Directory.GetFiles(this.Directory)) { |
||||||
|
string file = Path.GetFileName(fullpath); |
||||||
|
FileNode node; |
||||||
|
if (fileNodeDictionary.TryGetValue(file, out node)) { |
||||||
|
if (node.FileNodeStatus == FileNodeStatus.None) |
||||||
|
node.FileNodeStatus = FileNodeStatus.InProject; |
||||||
|
} else { |
||||||
|
node = new FileNode(file); |
||||||
|
node.AddTo(this); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <author name="Daniel Grunwald"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
using System.Windows.Forms; |
||||||
|
|
||||||
|
namespace FSharpBinding |
||||||
|
{ |
||||||
|
public class FSharpProjectNodeBuilder : IProjectNodeBuilder |
||||||
|
{ |
||||||
|
public bool CanBuildProjectTree(IProject project) |
||||||
|
{ |
||||||
|
return project is FSharpProject; |
||||||
|
} |
||||||
|
|
||||||
|
public TreeNode AddProjectNode(TreeNode motherNode, IProject project) |
||||||
|
{ |
||||||
|
FSharpProjectNode prjNode = new FSharpProjectNode(project); |
||||||
|
prjNode.AddTo(motherNode); |
||||||
|
new ReferenceFolder(project).AddTo(prjNode); |
||||||
|
return prjNode; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,24 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <author name="Daniel Grunwald"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using System; |
||||||
|
using ICSharpCode.SharpDevelop.Gui.OptionPanels; |
||||||
|
using System.Windows.Forms; |
||||||
|
|
||||||
|
namespace FSharpBinding |
||||||
|
{ |
||||||
|
public class FsOptions : AbstractXmlFormsProjectOptionPanel |
||||||
|
{ |
||||||
|
public override void LoadPanelContents() |
||||||
|
{ |
||||||
|
SetupFromXmlStream(typeof(FsOptions).Assembly.GetManifestResourceStream("FSharpBinding.Resources.FsOptions.xfrm")); |
||||||
|
InitializeHelper(); |
||||||
|
helper.BindBoolean(Get<CheckBox>("standalone"), "Standalone", false); |
||||||
|
helper.BindBoolean(Get<CheckBox>("nomllib"), "NoMLLib", false); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,89 @@ |
|||||||
|
// <file>
|
||||||
|
// <copyright see="prj:///doc/copyright.txt"/>
|
||||||
|
// <license see="prj:///doc/license.txt"/>
|
||||||
|
// <author name="Daniel Grunwald"/>
|
||||||
|
// <version>$Revision$</version>
|
||||||
|
// </file>
|
||||||
|
|
||||||
|
using ICSharpCode.Core; |
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.IO; |
||||||
|
using System.Windows.Forms; |
||||||
|
using System.Xml; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
|
||||||
|
namespace FSharpBinding |
||||||
|
{ |
||||||
|
public static class ProjectHelpers |
||||||
|
{ |
||||||
|
public static IEnumerable<FileNode> getFileNodes(TreeNodeCollection nodes) |
||||||
|
{ |
||||||
|
foreach (TreeNode node in nodes) { |
||||||
|
FileNode fileNode = node as FileNode; |
||||||
|
if (fileNode != null && fileNode.ProjectItem != null) { |
||||||
|
yield return fileNode; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static void reorderItems(TreeNodeCollection nodes, IProject project) |
||||||
|
{ |
||||||
|
//ProjectService.MarkProjectDirty(project)
|
||||||
|
project.Save(); |
||||||
|
XmlDocument doc = new XmlDocument(); |
||||||
|
doc.Load(project.FileName); |
||||||
|
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable); |
||||||
|
nsmgr.AddNamespace("proj", "http://schemas.microsoft.com/developer/msbuild/2003"); |
||||||
|
var d = new Dictionary<FileNode, XmlNode>(); |
||||||
|
foreach (FileNode node in getFileNodes(nodes)) { |
||||||
|
var docNode = doc.SelectSingleNode("//proj:Compile[@Include=\"" + Path.GetFileName(node.FileName) + "\"]", nsmgr); |
||||||
|
if (docNode != null) { |
||||||
|
d[node] = docNode; |
||||||
|
docNode.ParentNode.RemoveChild(docNode); |
||||||
|
} |
||||||
|
} |
||||||
|
var itemNode = doc.SelectSingleNode("//proj:ItemGroup", nsmgr); |
||||||
|
foreach (FileNode node in getFileNodes(nodes)) { |
||||||
|
XmlNode xmlElem; |
||||||
|
if (d.TryGetValue(node, out xmlElem)) |
||||||
|
itemNode.AppendChild(xmlElem); |
||||||
|
} |
||||||
|
doc.Save(project.FileName); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public class MoveUpFileEvent : AbstractMenuCommand |
||||||
|
{ |
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
FileNode node = ProjectBrowserPad.Instance.SelectedNode as FileNode; |
||||||
|
if (node != null) { |
||||||
|
TreeNode parent = node.Parent; |
||||||
|
int nodeIndex = parent.Nodes.IndexOf(node); |
||||||
|
if (nodeIndex > 1) { |
||||||
|
parent.Nodes.Remove(node); |
||||||
|
parent.Nodes.Insert(nodeIndex - 1, node); |
||||||
|
} |
||||||
|
ProjectHelpers.reorderItems(parent.Nodes, node.Project); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public class MoveDownFileEvent : AbstractMenuCommand |
||||||
|
{ |
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
FileNode node = ProjectBrowserPad.Instance.SelectedNode as FileNode; |
||||||
|
if (node != null) { |
||||||
|
TreeNode parent = node.Parent; |
||||||
|
int nodeIndex = parent.Nodes.IndexOf(node); |
||||||
|
if (nodeIndex < parent.Nodes.Count) { |
||||||
|
parent.Nodes.Remove(node); |
||||||
|
parent.Nodes.Insert(nodeIndex + 1, node); |
||||||
|
} |
||||||
|
ProjectHelpers.reorderItems(parent.Nodes, node.Project); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
#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("FSharpBinding")] |
||||||
|
[assembly: AssemblyDescription("")] |
||||||
|
[assembly: AssemblyConfiguration("")] |
||||||
|
[assembly: AssemblyTrademark("")] |
||||||
|
[assembly: AssemblyCulture("")] |
Loading…
Reference in new issue