diff --git a/.github/workflows/monodevelop.yml b/.github/workflows/monodevelop.yml
index 6ee4aab56cc..8b9786b7e3d 100644
--- a/.github/workflows/monodevelop.yml
+++ b/.github/workflows/monodevelop.yml
@@ -66,3 +66,61 @@ jobs:
run: |
./configure --profile=gnome
make
+
+ ubuntu2004msbuild:
+ runs-on: ubuntu-latest
+ container:
+ # This is (currently) the cached docker image SHA256:aba80b77...40417fe dated 17/06/2021
+ image: "ubuntu:20.04"
+ steps:
+ - name: Dependencies
+ run: |
+ # Install extra ubuntu packages
+ apt-get update
+ apt-get install -y sudo
+ sudo apt-get update
+ # Install dotnet-sdk packages
+ sudo apt-get install -y wget
+ wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
+ sudo dpkg -i packages-microsoft-prod.deb
+ sudo apt-get install -y apt-transport-https
+ sudo apt-get update
+ sudo apt-get install -y dotnet-sdk-6.0
+ # Install mono and msbuild
+ sudo apt-get install -y gnupg ca-certificates
+ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
+ # Reference mono and msbuild from stable repo for versions 6.12.0.122 (mono) and 16.6.0.15201 (msbuild)
+ # echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
+ # Reference mono and msbuild from preview repo for versions 6.12.0.147 (mono) and 16.10.1 (msbuild)
+ echo "deb https://download.mono-project.com/repo/ubuntu preview-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-preview.list
+ sudo apt-get update
+ # Install mono-complete and ca-certificates-mono
+ sudo apt-get install -y mono-complete ca-certificates-mono
+ # Synchronise Mono SSL certs
+ cert-sync /etc/ssl/certs/ca-certificates.crt
+ # Install extra packages required for dotdevelop build
+ sudo apt-get install -y sed git build-essential intltool nuget fsharp gtk-sharp2
+ sudo apt-get install -y software-properties-common
+ sudo apt-get update
+ - name: Verify OS and tools versions
+ run: |
+ uname -a
+ git --version
+ make --version
+ mono -V
+ msbuild -version
+ dotnet --info
+ git config --global --add safe.directory /__w/dotdevelop/dotdevelop
+
+ # Checkout, configure and build
+ - uses: actions/checkout@v3
+ with:
+ submodules: true
+ - name: Checkout configure and build
+ run: |
+ cd main
+ cd external/fsharpbinding
+ ./build.sh
+ cd ..
+ cd ..
+ ./build.sh
diff --git a/.gitmodules b/.gitmodules
index e0d4812f099..2c926403cd0 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,10 +1,10 @@
[submodule "main/external/debugger-libs"]
path = main/external/debugger-libs
- url = https://github.com/dotdevelop/debugger-libs.git
+ url = https://github.com/easysimplified/debugger-libs.git
branch = master
[submodule "main/external/guiunit"]
path = main/external/guiunit
- url = https://github.com/dotdevelop/guiunit.git
+ url = https://github.com/easysimplified/guiunit.git
[submodule "main/external/macdoc"]
path = main/external/macdoc
url = https://github.com/dotdevelop/macdoc
@@ -20,13 +20,13 @@
url = https://github.com/dotdevelop/mono-tools.git
[submodule "main/external/nrefactory"]
path = main/external/nrefactory
- url = https://github.com/dotdevelop/NRefactory.git
+ url = https://github.com/easysimplified/NRefactory.git
[submodule "main/external/sharpsvn-binary"]
path = main/external/sharpsvn-binary
url = https://github.com/dotdevelop/sharpsvn-binary.git
[submodule "main/external/xwt"]
path = main/external/xwt
- url = https://github.com/dotdevelop/xwt
+ url = https://github.com/easysimplified/xwt
branch = dotdevelop
[submodule "main/external/Xamarin.PropertyEditing"]
path = main/external/Xamarin.PropertyEditing
@@ -34,7 +34,7 @@
branch = master
[submodule "main/external/vs-editor-api"]
path = main/external/vs-editor-api
- url = https://github.com/dotdevelop/vs-editor-api.git
+ url = https://github.com/easysimplified/vs-editor-api.git
branch = dotdevelop_oe_8.1.5
[submodule "main/external/Monodevelop.Netcoredbg"]
path = main/external/Monodevelop.Netcoredbg
diff --git a/main/Directory.Build.props b/main/Directory.Build.props
index f501d998f17..6d81338775c 100644
--- a/main/Directory.Build.props
+++ b/main/Directory.Build.props
@@ -7,7 +7,7 @@
$(MSBuildThisFileDirectory)..\..\md-addins\
$(MSBuildThisFileDirectory)external\vs-editor-api\
- $(RootDirectory)\msbuild\ReferencesVSEditor.Windows.props
+ $(RootDirectory)\msbuild\ReferencesVSEditor.Gtk.props
$(RootDirectory)\msbuild\ReferencesVSEditor.Mac.props
$(RootDirectory)\msbuild\ReferencesVSEditor.Gtk.props
$(RootDirectory)\msbuild\ReferencesGtk.props
diff --git a/main/Main.sln b/main/Main.sln
index e6d3b9db6f9..112a2d5b23d 100644
--- a/main/Main.sln
+++ b/main/Main.sln
@@ -332,8 +332,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.AspNetCore.Test
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "MonoDevelop.TextEditor", "MonoDevelop.TextEditor", "{C14B06AC-905A-47AB-BAD9-652E3499CFE0}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonoDevelop.TextEditor.Wpf", "src\addins\MonoDevelop.TextEditor\MonoDevelop.TextEditor.Wpf\MonoDevelop.TextEditor.Wpf.csproj", "{29D34EA6-D312-4690-9FE9-1EA1F2EBAC2E}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "vs-editor-api", "vs-editor-api", "{669BD438-1BDC-40C6-83CA-CEC133D036A0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonoDevelop.TextEditor", "src\addins\MonoDevelop.TextEditor\MonoDevelop.TextEditor\MonoDevelop.TextEditor.csproj", "{3F5B5BDA-69D5-441A-8142-AA25C998A997}"
@@ -2139,16 +2137,6 @@ Global
{44FFFDDA-156F-49F9-AE6A-BA640C198B33}.Debug|x86.Build.0 = Debug|Any CPU
{44FFFDDA-156F-49F9-AE6A-BA640C198B33}.Release|x86.ActiveCfg = Release|Any CPU
{44FFFDDA-156F-49F9-AE6A-BA640C198B33}.Release|x86.Build.0 = Release|Any CPU
- {29D34EA6-D312-4690-9FE9-1EA1F2EBAC2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {29D34EA6-D312-4690-9FE9-1EA1F2EBAC2E}.DebugGnome|Any CPU.ActiveCfg = Debug|Any CPU
- {29D34EA6-D312-4690-9FE9-1EA1F2EBAC2E}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
- {29D34EA6-D312-4690-9FE9-1EA1F2EBAC2E}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU
- {29D34EA6-D312-4690-9FE9-1EA1F2EBAC2E}.DebugWin32|Any CPU.Build.0 = Debug|Any CPU
- {29D34EA6-D312-4690-9FE9-1EA1F2EBAC2E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {29D34EA6-D312-4690-9FE9-1EA1F2EBAC2E}.ReleaseGnome|Any CPU.ActiveCfg = Release|Any CPU
- {29D34EA6-D312-4690-9FE9-1EA1F2EBAC2E}.ReleaseMac|Any CPU.ActiveCfg = Release|Any CPU
- {29D34EA6-D312-4690-9FE9-1EA1F2EBAC2E}.ReleaseWin32|Any CPU.ActiveCfg = Release|Any CPU
- {29D34EA6-D312-4690-9FE9-1EA1F2EBAC2E}.ReleaseWin32|Any CPU.Build.0 = Release|Any CPU
{44FFFDDA-156F-49F9-AE6A-BA640C198B33}.Debug|x86.ActiveCfg = Debug|Any CPU
{44FFFDDA-156F-49F9-AE6A-BA640C198B33}.Debug|x86.Build.0 = Debug|Any CPU
{44FFFDDA-156F-49F9-AE6A-BA640C198B33}.Release|x86.ActiveCfg = Release|Any CPU
@@ -3074,7 +3062,6 @@ Global
{82B9A5C5-5713-49B5-93D1-BE29B00FF35A} = {D0469BC0-3DF4-4CE9-A9E3-3268359BAC2E}
{44FFFDDA-156F-49F9-AE6A-BA640C198B33} = {1DEFDD53-2677-439D-906E-141ED2AEC19B}
{C14B06AC-905A-47AB-BAD9-652E3499CFE0} = {D417E929-2B3A-46AC-BBE8-027ADB63A790}
- {29D34EA6-D312-4690-9FE9-1EA1F2EBAC2E} = {C14B06AC-905A-47AB-BAD9-652E3499CFE0}
{3F5B5BDA-69D5-441A-8142-AA25C998A997} = {C14B06AC-905A-47AB-BAD9-652E3499CFE0}
{669BD438-1BDC-40C6-83CA-CEC133D036A0} = {C14B06AC-905A-47AB-BAD9-652E3499CFE0}
{5A92B792-BF17-4748-B29E-34C99B2E8722} = {669BD438-1BDC-40C6-83CA-CEC133D036A0}
@@ -3233,4 +3220,4 @@ Global
MakePkgConfig = False
MakeLibPC = True
EndGlobalSection
-EndGlobal
+EndGlobal
\ No newline at end of file
diff --git a/main/build.sh b/main/build.sh
new file mode 100755
index 00000000000..020ee3a753f
--- /dev/null
+++ b/main/build.sh
@@ -0,0 +1,5 @@
+nuget restore
+
+msbuild external/fsharpbinding/.paket/paket.targets /t:RestorePackages /p:PaketReferences="external\fsharpbinding\MonoDevelop.FSharpBinding\paket.references"
+
+msbuild Main.sln /bl:MonoDevelop.binlog /r /m /p:Configuration=DebugGnome /p:PLATFORM='Any CPU'
diff --git a/main/external/debugger-libs b/main/external/debugger-libs
index aae0e23e345..e01783f649f 160000
--- a/main/external/debugger-libs
+++ b/main/external/debugger-libs
@@ -1 +1 @@
-Subproject commit aae0e23e345caa1f3652b0e6b7d9e5bf49037ef3
+Subproject commit e01783f649f4beb21074c1111929c90bb7b9c326
diff --git a/main/external/fsharpbinding/MonoDevelop.FSharp.sln b/main/external/fsharpbinding/MonoDevelop.FSharp.sln
index 08ea72b993f..6b6631f1adc 100644
--- a/main/external/fsharpbinding/MonoDevelop.FSharp.sln
+++ b/main/external/fsharpbinding/MonoDevelop.FSharp.sln
@@ -8,14 +8,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{165E4D
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.FSharp.Gui", "MonoDevelop.FSharp.Gui\MonoDevelop.FSharp.Gui.csproj", "{FD0D1033-9145-48E5-8ED8-E2365252878C}"
EndProject
-Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "MonoDevelop.FSharp.fastbuild", "MonoDevelop.FSharpBinding\MonoDevelop.FSharp.fastbuild.fsproj", "{4C10F8F9-3816-4647-BA6E-85F5DE39883A}"
-EndProject
-Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "MonoDevelop.FSharp.Tests.fastbuild", "MonoDevelop.FSharp.Tests\MonoDevelop.FSharp.Tests.fastbuild.fsproj", "{A1A45375-7FB8-4F2A-850F-FBCC67739927}"
-EndProject
-Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "MonoDevelop.FSharpInteractive.Service.fastbuild", "MonoDevelop.FSharpi.Service\MonoDevelop.FSharpInteractive.Service.fastbuild.fsproj", "{20D6EC2C-B62E-49D1-B685-90D8967A5B5D}"
-EndProject
-Project("{f2a71f9b-5d33-465a-a702-920d77279786}") = "MonoDevelop.FSharp.Shared.fastbuild", "MonoDevelop.FSharp.Shared\MonoDevelop.FSharp.Shared.fastbuild.fsproj", "{AF5FEAD5-B50E-4F07-A274-32F23D5C504D}"
-EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FAKE", "FAKE", "{0926DD37-C0FF-464E-96A9-42D5AAA48D1B}"
ProjectSection(SolutionItems) = preProject
build.fsx = build.fsx
@@ -32,34 +24,6 @@ Global
Standalone|Any CPU = Standalone|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {4C10F8F9-3816-4647-BA6E-85F5DE39883A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {4C10F8F9-3816-4647-BA6E-85F5DE39883A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {4C10F8F9-3816-4647-BA6E-85F5DE39883A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {4C10F8F9-3816-4647-BA6E-85F5DE39883A}.Release|Any CPU.Build.0 = Release|Any CPU
- {4C10F8F9-3816-4647-BA6E-85F5DE39883A}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU
- {4C10F8F9-3816-4647-BA6E-85F5DE39883A}.DebugWin32|Any CPU.Build.0 = Debug|Any CPU
- {4C10F8F9-3816-4647-BA6E-85F5DE39883A}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
- {4C10F8F9-3816-4647-BA6E-85F5DE39883A}.DebugMac|Any CPU.Build.0 = Debug|Any CPU
- {4C10F8F9-3816-4647-BA6E-85F5DE39883A}.ReleaseMac|Any CPU.ActiveCfg = Debug|Any CPU
- {4C10F8F9-3816-4647-BA6E-85F5DE39883A}.ReleaseMac|Any CPU.Build.0 = Debug|Any CPU
- {4C10F8F9-3816-4647-BA6E-85F5DE39883A}.ReleaseWin32|Any CPU.ActiveCfg = Debug|Any CPU
- {4C10F8F9-3816-4647-BA6E-85F5DE39883A}.ReleaseWin32|Any CPU.Build.0 = Debug|Any CPU
- {4C10F8F9-3816-4647-BA6E-85F5DE39883A}.Standalone|Any CPU.ActiveCfg = Debug|Any CPU
- {4C10F8F9-3816-4647-BA6E-85F5DE39883A}.Standalone|Any CPU.Build.0 = Debug|Any CPU
- {A1A45375-7FB8-4F2A-850F-FBCC67739927}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A1A45375-7FB8-4F2A-850F-FBCC67739927}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A1A45375-7FB8-4F2A-850F-FBCC67739927}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A1A45375-7FB8-4F2A-850F-FBCC67739927}.Release|Any CPU.Build.0 = Release|Any CPU
- {A1A45375-7FB8-4F2A-850F-FBCC67739927}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU
- {A1A45375-7FB8-4F2A-850F-FBCC67739927}.DebugWin32|Any CPU.Build.0 = Debug|Any CPU
- {A1A45375-7FB8-4F2A-850F-FBCC67739927}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
- {A1A45375-7FB8-4F2A-850F-FBCC67739927}.DebugMac|Any CPU.Build.0 = Debug|Any CPU
- {A1A45375-7FB8-4F2A-850F-FBCC67739927}.ReleaseMac|Any CPU.ActiveCfg = Debug|Any CPU
- {A1A45375-7FB8-4F2A-850F-FBCC67739927}.ReleaseMac|Any CPU.Build.0 = Debug|Any CPU
- {A1A45375-7FB8-4F2A-850F-FBCC67739927}.ReleaseWin32|Any CPU.ActiveCfg = Debug|Any CPU
- {A1A45375-7FB8-4F2A-850F-FBCC67739927}.ReleaseWin32|Any CPU.Build.0 = Debug|Any CPU
- {A1A45375-7FB8-4F2A-850F-FBCC67739927}.Standalone|Any CPU.ActiveCfg = Debug|Any CPU
- {A1A45375-7FB8-4F2A-850F-FBCC67739927}.Standalone|Any CPU.Build.0 = Debug|Any CPU
{FD0D1033-9145-48E5-8ED8-E2365252878C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FD0D1033-9145-48E5-8ED8-E2365252878C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FD0D1033-9145-48E5-8ED8-E2365252878C}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -74,34 +38,6 @@ Global
{FD0D1033-9145-48E5-8ED8-E2365252878C}.ReleaseWin32|Any CPU.Build.0 = Debug|Any CPU
{FD0D1033-9145-48E5-8ED8-E2365252878C}.Standalone|Any CPU.ActiveCfg = Debug|Any CPU
{FD0D1033-9145-48E5-8ED8-E2365252878C}.Standalone|Any CPU.Build.0 = Debug|Any CPU
- {20D6EC2C-B62E-49D1-B685-90D8967A5B5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {20D6EC2C-B62E-49D1-B685-90D8967A5B5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {20D6EC2C-B62E-49D1-B685-90D8967A5B5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {20D6EC2C-B62E-49D1-B685-90D8967A5B5D}.Release|Any CPU.Build.0 = Release|Any CPU
- {20D6EC2C-B62E-49D1-B685-90D8967A5B5D}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU
- {20D6EC2C-B62E-49D1-B685-90D8967A5B5D}.DebugWin32|Any CPU.Build.0 = Debug|Any CPU
- {20D6EC2C-B62E-49D1-B685-90D8967A5B5D}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
- {20D6EC2C-B62E-49D1-B685-90D8967A5B5D}.DebugMac|Any CPU.Build.0 = Debug|Any CPU
- {20D6EC2C-B62E-49D1-B685-90D8967A5B5D}.ReleaseMac|Any CPU.ActiveCfg = Debug|Any CPU
- {20D6EC2C-B62E-49D1-B685-90D8967A5B5D}.ReleaseMac|Any CPU.Build.0 = Debug|Any CPU
- {20D6EC2C-B62E-49D1-B685-90D8967A5B5D}.ReleaseWin32|Any CPU.ActiveCfg = Debug|Any CPU
- {20D6EC2C-B62E-49D1-B685-90D8967A5B5D}.ReleaseWin32|Any CPU.Build.0 = Debug|Any CPU
- {20D6EC2C-B62E-49D1-B685-90D8967A5B5D}.Standalone|Any CPU.ActiveCfg = Debug|Any CPU
- {20D6EC2C-B62E-49D1-B685-90D8967A5B5D}.Standalone|Any CPU.Build.0 = Debug|Any CPU
- {AF5FEAD5-B50E-4F07-A274-32F23D5C504D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AF5FEAD5-B50E-4F07-A274-32F23D5C504D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {AF5FEAD5-B50E-4F07-A274-32F23D5C504D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AF5FEAD5-B50E-4F07-A274-32F23D5C504D}.Release|Any CPU.Build.0 = Release|Any CPU
- {AF5FEAD5-B50E-4F07-A274-32F23D5C504D}.DebugWin32|Any CPU.ActiveCfg = Debug|Any CPU
- {AF5FEAD5-B50E-4F07-A274-32F23D5C504D}.DebugWin32|Any CPU.Build.0 = Debug|Any CPU
- {AF5FEAD5-B50E-4F07-A274-32F23D5C504D}.DebugMac|Any CPU.ActiveCfg = Debug|Any CPU
- {AF5FEAD5-B50E-4F07-A274-32F23D5C504D}.DebugMac|Any CPU.Build.0 = Debug|Any CPU
- {AF5FEAD5-B50E-4F07-A274-32F23D5C504D}.ReleaseMac|Any CPU.ActiveCfg = Debug|Any CPU
- {AF5FEAD5-B50E-4F07-A274-32F23D5C504D}.ReleaseMac|Any CPU.Build.0 = Debug|Any CPU
- {AF5FEAD5-B50E-4F07-A274-32F23D5C504D}.ReleaseWin32|Any CPU.ActiveCfg = Debug|Any CPU
- {AF5FEAD5-B50E-4F07-A274-32F23D5C504D}.ReleaseWin32|Any CPU.Build.0 = Debug|Any CPU
- {AF5FEAD5-B50E-4F07-A274-32F23D5C504D}.Standalone|Any CPU.ActiveCfg = Debug|Any CPU
- {AF5FEAD5-B50E-4F07-A274-32F23D5C504D}.Standalone|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
EndGlobalSection
diff --git a/main/external/guiunit b/main/external/guiunit
index 9affe481398..ceeb09c8f25 160000
--- a/main/external/guiunit
+++ b/main/external/guiunit
@@ -1 +1 @@
-Subproject commit 9affe4813987b009022ab7b10e55f81f4a37344c
+Subproject commit ceeb09c8f253edfd3bed78f1fc3f14c68d9f8fb5
diff --git a/main/external/nrefactory b/main/external/nrefactory
index 60ac8e99c51..074fabe9ba5 160000
--- a/main/external/nrefactory
+++ b/main/external/nrefactory
@@ -1 +1 @@
-Subproject commit 60ac8e99c51e43a58a4dc124b9680fb73c2f974b
+Subproject commit 074fabe9ba5dee3e02421538f596151344528f6a
diff --git a/main/external/vs-editor-api b/main/external/vs-editor-api
index 71b2d6b03cc..a86e95634d6 160000
--- a/main/external/vs-editor-api
+++ b/main/external/vs-editor-api
@@ -1 +1 @@
-Subproject commit 71b2d6b03ccaf515f5ccfeea85999b65bd9b22b4
+Subproject commit a86e95634d6deccb5726ccc22fe3aaba6224954e
diff --git a/main/external/xwt b/main/external/xwt
index b191f50b079..042a2c85edb 160000
--- a/main/external/xwt
+++ b/main/external/xwt
@@ -1 +1 @@
-Subproject commit b191f50b079c49df4426302fe84c53baeec6c721
+Subproject commit 042a2c85edb02447f45a65aa1a46fd9cbbcf6dbf
diff --git a/main/msbuild/MDBuildTasks.targets b/main/msbuild/MDBuildTasks.targets
index cf3615b0ece..dfa4ffe1799 100644
--- a/main/msbuild/MDBuildTasks.targets
+++ b/main/msbuild/MDBuildTasks.targets
@@ -175,7 +175,6 @@
=================================================================
-->
-
false
false
- $(DefineConstants);GTK3;GTK_SHARP
+ $(DefineConstants);GTK3;GTK_SHARP;MAC
-
+
diff --git a/main/src/addins/GnomePlatform/GnomePlatform.cs b/main/src/addins/GnomePlatform/GnomePlatform.cs
index f775d460162..3ca250b46df 100644
--- a/main/src/addins/GnomePlatform/GnomePlatform.cs
+++ b/main/src/addins/GnomePlatform/GnomePlatform.cs
@@ -33,6 +33,7 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
+using System.Runtime.InteropServices;
using MonoDevelop.Core.Execution;
using MonoDevelop.Core;
@@ -81,11 +82,17 @@ public override void ShowUrl (string url)
public override string DefaultMonospaceFont {
get {
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) {
+
try {
return (string) (Gio.GetGSettingsString ("org.gnome.desktop.interface","monospace-font-name"));
} catch (Exception) {
return "Monospace 11";
}
+ }
+ else{
+ return "Monospace 11";
+ }
}
}
diff --git a/main/src/addins/GnomePlatform/GnomePlatform.csproj b/main/src/addins/GnomePlatform/GnomePlatform.csproj
index 0d187bddba9..9acff7affcb 100644
--- a/main/src/addins/GnomePlatform/GnomePlatform.csproj
+++ b/main/src/addins/GnomePlatform/GnomePlatform.csproj
@@ -11,6 +11,7 @@
true
+
diff --git a/main/src/addins/MonoDevelop.DesignerSupport.Mac/MonoDevelop.DesignerSupport.Mac.csproj b/main/src/addins/MonoDevelop.DesignerSupport.Mac/MonoDevelop.DesignerSupport.Mac.csproj
index 45989912d13..2078c45e683 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport.Mac/MonoDevelop.DesignerSupport.Mac.csproj
+++ b/main/src/addins/MonoDevelop.DesignerSupport.Mac/MonoDevelop.DesignerSupport.Mac.csproj
@@ -1,4 +1,4 @@
-
+
@@ -14,31 +14,31 @@
-
- ..\..\..\external\Xamarin.Mac.dll
- False
-
-
- {B7C1673E-5124-4BE5-8D21-EC8B12F85B6B}
- Xwt.XamMac
- False
-
+
+ ..\..\..\external\Xamarin.Mac.dll
+ False
+
+
+ {B7C1673E-5124-4BE5-8D21-EC8B12F85B6B}
+ Xwt.XamMac
+ False
+
{E8F4F0EB-C2B1-4116-8459-E076E0E0E485}
Xamarin.PropertyEditing.Mac
-
-
- {A0B6FE73-D046-4E1C-BA9D-F20683889C5A}
- Xamarin.PropertyEditing
-
-
-
-
- {2C24D515-4A2C-445C-8419-C09231913CFA}
- MonoDevelop.DesignerSupport
-
+
+
+ {A0B6FE73-D046-4E1C-BA9D-F20683889C5A}
+ Xamarin.PropertyEditing
+
+
+
+
+ {2C24D515-4A2C-445C-8419-C09231913CFA}
+ MonoDevelop.DesignerSupport
+
-
+
@@ -92,4 +92,4 @@
-
+
\ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/AddinInfo.cs b/main/src/addins/MonoDevelop.DesignerSupport/AddinInfo.cs
index 60adee7d2d9..d20e2733ffd 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/AddinInfo.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/AddinInfo.cs
@@ -15,6 +15,7 @@
[assembly:AddinDependency ("Core", MonoDevelop.BuildInfo.Version)]
[assembly:AddinDependency ("Ide", MonoDevelop.BuildInfo.Version)]
+
#if MAC
[assembly: ImportAddinAssembly ("Xamarin.PropertyEditing.dll")]
[assembly: ImportAddinAssembly ("Xamarin.PropertyEditing.Mac.dll")]
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Styles.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Styles.cs
index 2f745c851ff..36f2e25e1fe 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Styles.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Styles.cs
@@ -1,5 +1,5 @@
-#if MAC
-using AppKit;
+#if MAC
+using AppKit;
using MonoDevelop.Core.FeatureConfiguration;
using MonoDevelop.Ide;
using Xamarin.PropertyEditing.Mac;
@@ -7,23 +7,23 @@
namespace MonoDevelop.DesignerSupport
{
static class Styles
- {
+ {
public static NSColor SectionForegroundColor { get; internal set; } = NSColor.Text;
public static NSColor SectionBackgroundColor { get; private set; } = NSColor.ControlLightHighlight;
public static NSColor CellBackgroundSelectedColor { get; private set; }
public static NSColor CellBackgroundUnfocusedSelectedColor { get; private set; } = NSColor.FromRgb (0.64f, 0.64f, 0.64f);
public static NSColor CellBackgroundColor { get; private set; } = NSColor.ControlBackground;
- public static NSColor LabelSelectedForegroundColor { get; private set; }
+ public static NSColor LabelSelectedForegroundColor { get; private set; }
- public static NSColor HeaderBackgroundColor { get; private set; }
- public static NSColor HeaderBorderBackgroundColor { get; private set; }
-
- public static NSColor ToolbarBackgroundColor { get; private set; }
-
- public static PropertyPadStyle PropertyPad { get; private set; }
-
- // Used for the property panel in Xamarin.PropertyEditing
+ public static NSColor HeaderBackgroundColor { get; private set; }
+ public static NSColor HeaderBorderBackgroundColor { get; private set; }
+
+ public static NSColor ToolbarBackgroundColor { get; private set; }
+
+ public static PropertyPadStyle PropertyPad { get; private set; }
+
+ // Used for the property panel in Xamarin.PropertyEditing
public class PropertyPadStyle
{
public NSColor Checkerboard0 { get; internal set; }
@@ -32,24 +32,24 @@ public class PropertyPadStyle
public NSColor FrameBoxButtonBackgroundColor { get; internal set; }
public NSColor TabBorderColor { get; internal set; }
public NSColor PanelTabBackground { get; internal set; }
- }
+ }
- static Styles ()
- {
- LoadStyles ();
- Ide.Gui.Styles.Changed += (o, e) => LoadStyles ();
- }
+ static Styles ()
+ {
+ LoadStyles ();
+ Ide.Gui.Styles.Changed += (o, e) => LoadStyles ();
+ }
- public static void LoadStyles ()
+ public static void LoadStyles ()
{
if (IdeApp.Preferences.UserInterfaceTheme == Theme.Light) {
HeaderBackgroundColor = NSColor.FromRgb (0.98f, 0.98f, 0.98f);
- HeaderBorderBackgroundColor = NSColor.FromRgb (0.96f, 0.96f, 0.96f);
- LabelSelectedForegroundColor = NSColor.Highlight;
- ToolbarBackgroundColor = NSColor.White;
- CellBackgroundSelectedColor = NSColor.FromRgb (0.36f, 0.54f, 0.90f);
-
-
+ HeaderBorderBackgroundColor = NSColor.FromRgb (0.96f, 0.96f, 0.96f);
+ LabelSelectedForegroundColor = NSColor.Highlight;
+ ToolbarBackgroundColor = NSColor.White;
+ CellBackgroundSelectedColor = NSColor.FromRgb (0.36f, 0.54f, 0.90f);
+
+
PropertyPad = new PropertyPadStyle {
Checkerboard0 = NSColor.FromRgb (255, 255, 255),
Checkerboard1 = NSColor.FromRgb (217, 217, 217),
@@ -59,10 +59,10 @@ public static void LoadStyles ()
FrameBoxButtonBackgroundColor = NSColor.FromRgb (0.36f, 0.54f, 0.90f)
};
} else {
- CellBackgroundSelectedColor = NSColor.FromRgb (0.38f, 0.55f, 0.91f);
- HeaderBackgroundColor = NSColor.FromRgb (0.29f, 0.29f, 0.29f);
- HeaderBorderBackgroundColor = NSColor.FromRgb (0.29f, 0.29f, 0.29f);
- LabelSelectedForegroundColor = NSColor.SelectedText;
+ CellBackgroundSelectedColor = NSColor.FromRgb (0.38f, 0.55f, 0.91f);
+ HeaderBackgroundColor = NSColor.FromRgb (0.29f, 0.29f, 0.29f);
+ HeaderBorderBackgroundColor = NSColor.FromRgb (0.29f, 0.29f, 0.29f);
+ LabelSelectedForegroundColor = NSColor.SelectedText;
ToolbarBackgroundColor = NSColor.FromRgb (0.25f, 0.25f, 0.25f);
PropertyPad = new PropertyPadStyle {
@@ -74,7 +74,7 @@ public static void LoadStyles ()
FrameBoxButtonBackgroundColor = NSColor.FromRgb (0.38f, 0.55f, 0.91f)
};
}
- }
+ }
}
}
#endif
diff --git a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/PropertyPad.cs b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/PropertyPad.cs
index 3d8560b3966..6357cfaf205 100644
--- a/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/PropertyPad.cs
+++ b/main/src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport/PropertyPad.cs
@@ -106,7 +106,7 @@ public object CurrentObject {
public PropertyGridWrapper ()
{
#if MAC
- nativeWidget = new PropertyMacHostWidget ();
+ nativeWidget = new PropertyMacHostWidget ();
#else
nativeWidget = new PropertyXwtHostWidget ();
#endif
@@ -191,11 +191,11 @@ protected override void Initialize (IPadWindow container)
propertyGridWrapper.SetToolbarProvider (toolbarProvider);
#if MAC
- //native cocoa needs content shown to initialize stuff
- if (isNative) {
- container.PadContentShown += Window_PadContentShown;
- container.PadContentHidden += Window_PadContentHidden;
- }
+ //native cocoa needs content shown to initialize stuff
+ if (isNative) {
+ container.PadContentShown += Window_PadContentShown;
+ container.PadContentHidden += Window_PadContentHidden;
+ }
#endif
this.container = container;
@@ -215,10 +215,10 @@ public override Control Control {
public override void Dispose()
{
#if MAC
- if (isNative) {
- container.PadContentShown -= Window_PadContentShown;
- container.PadContentHidden -= Window_PadContentHidden;
- }
+ if (isNative) {
+ container.PadContentShown -= Window_PadContentShown;
+ container.PadContentHidden -= Window_PadContentHidden;
+ }
#endif
propertyGridWrapper.PropertyGridChanged -= Grid_Changed;
@@ -270,21 +270,21 @@ public void BlankPad ()
}
#if MAC
- void Window_PadContentShown (object sender, EventArgs e)
- {
- propertyGridWrapper.OnPadContentShown ();
+ void Window_PadContentShown (object sender, EventArgs e)
+ {
+ propertyGridWrapper.OnPadContentShown ();
- if (customWidget && frame.Child is GtkNSViewHost viewHost) {
- viewHost.Visible = true;
- }
- }
+ if (customWidget && frame.Child is GtkNSViewHost viewHost) {
+ viewHost.Visible = true;
+ }
+ }
- void Window_PadContentHidden (object sender, EventArgs e)
- {
- if (customWidget && frame.Child is GtkNSViewHost viewHost) {
- viewHost.Visible = false;
- }
- }
+ void Window_PadContentHidden (object sender, EventArgs e)
+ {
+ if (customWidget && frame.Child is GtkNSViewHost viewHost) {
+ viewHost.Visible = false;
+ }
+ }
#endif
void AttachToolbarIfCustomWidget ()
@@ -294,13 +294,14 @@ void AttachToolbarIfCustomWidget ()
frame.Remove (frame.Child);
#if MAC
- if (isNative) {
- frame.Add (propertyGridWrapper.Widget);
- } else {
+ if (isNative) {
+ frame.Add (propertyGridWrapper.Widget);
+ } else {
#endif
frame.Add (propertyGridWrapper.Widget);
+
#if MAC
- }
+ }
#endif
toolbarProvider.Attach (container.GetToolbar (DockPositionType.Top));
}
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
index 51f6b3c711f..8753cc01312 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.csproj
@@ -1,7 +1,7 @@
-
-
-
-
+
+
+
+
Debug
AnyCPU
@@ -16,10 +16,10 @@
-->
$(NoWarn);618;612
-
-
-
-
+
+
+
+
Program
mono
@@ -63,30 +63,30 @@
False
-
+
{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}
Xwt.GtkSharp
-
+
{C3887A93-B2BD-4097-8E2F-3A063EFF32FD}
Xwt.Gtk2
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
+
@@ -95,218 +95,218 @@
-
-
-
+
+
+
PreserveNewest
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
\ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Classification/WebClassification.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Classification/WebClassification.cs
deleted file mode 100644
index 69261b99cbf..00000000000
--- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Classification/WebClassification.cs
+++ /dev/null
@@ -1,224 +0,0 @@
-//
-// Copyright (c) Microsoft Corp. (https://www.microsoft.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System.ComponentModel.Composition;
-using System.Windows.Media;
-using Microsoft.VisualStudio.Language.StandardClassification;
-using Microsoft.VisualStudio.Text.Classification;
-using Microsoft.VisualStudio.Utilities;
-
-namespace MonoDevelop.Ide.Text
-{
- class WebClassification
- {
- [Export (typeof (EditorFormatDefinition))]
- [ClassificationType (ClassificationTypeNames = "HTML Element Name")]
- [Name ("HTML Element Name")]
- [UserVisible (true)]
- internal class ExportedClassificationFormatHTMLElementName : ClassificationFormatDefinition
- {
- internal ExportedClassificationFormatHTMLElementName ()
- {
- ForegroundColor = Colors.Maroon;
- }
- }
-
- [Export (typeof (EditorFormatDefinition))]
- [ClassificationType (ClassificationTypeNames = "HTML Attribute Name")]
- [Name ("HTML Attribute Name")]
- [UserVisible (true)]
- internal class ExportedClassificationFormatHTMLAttributeName : ClassificationFormatDefinition
- {
- internal ExportedClassificationFormatHTMLAttributeName ()
- {
- ForegroundColor = Colors.Red;
- }
- }
-
- [Export (typeof (EditorFormatDefinition))]
- [ClassificationType (ClassificationTypeNames = "HTML Attribute Value")]
- [Name ("HTML Attribute Value")]
- [UserVisible (true)]
- internal class ExportedClassificationFormatHTMLAttributeValue : ClassificationFormatDefinition
- {
- internal ExportedClassificationFormatHTMLAttributeValue ()
- {
- ForegroundColor = Colors.Blue;
- }
- }
-
- [Export (typeof (EditorFormatDefinition))]
- [ClassificationType (ClassificationTypeNames = "HTML Operator")]
- [Name ("HTML Operator")]
- [UserVisible (true)]
- internal class ExportedClassificationFormatHTMLOperator : ClassificationFormatDefinition
- {
- internal ExportedClassificationFormatHTMLOperator ()
- {
- ForegroundColor = Colors.Blue;
- }
- }
-
- [Export (typeof (EditorFormatDefinition))]
- [ClassificationType (ClassificationTypeNames = "HTML Tag Delimiter")]
- [Name ("HTML Tag Delimiter")]
- [UserVisible (true)]
- internal class ExportedClassificationFormatHTMLTagDelimiter : ClassificationFormatDefinition
- {
- internal ExportedClassificationFormatHTMLTagDelimiter ()
- {
- ForegroundColor = Colors.Blue;
- }
- }
-
- private const string RazorCode = nameof (RazorCode);
-
- [Export (typeof (EditorFormatDefinition))]
- [UserVisible (true)]
- [ClassificationType (ClassificationTypeNames = RazorCode)]
- [Name (RazorCode)]
- [Order]
- internal sealed class RazorCodeClassificationFormat : ClassificationFormatDefinition
- {
- public RazorCodeClassificationFormat ()
- {
- BackgroundColor = Color.FromRgb (0xE5, 0xE5, 0xE5);
- }
- }
-
- [Export (typeof (ClassificationTypeDefinition))]
- [Name (RazorCode), Export]
- internal ClassificationTypeDefinition RazorCodeClassificationType { get; set; }
-
- [Export (typeof (EditorFormatDefinition))]
- [ClassificationType (ClassificationTypeNames = "HTML Server-Side Script")]
- [Name ("HTML Server-Side Script")]
- [UserVisible (true)]
- internal class ExportedClassificationFormatHTMLServerSideScript : ClassificationFormatDefinition
- {
- internal ExportedClassificationFormatHTMLServerSideScript ()
- {
- ForegroundColor = Colors.Black;
- BackgroundColor = Colors.Yellow;
- }
- }
-
- [Export (typeof (EditorFormatDefinition))]
- [UserVisible (true)]
- [ClassificationType (ClassificationTypeNames = FormatName)]
- [Name (FormatName)]
- [Order (Before = LanguagePriority.FormalLanguage)]
- internal sealed class JsonPropertyNameClassificationFormat : ClassificationFormatDefinition
- {
- public const string FormatName = "JSON Property Name";
-
- public JsonPropertyNameClassificationFormat ()
- {
- ForegroundColor = Color.FromRgb (0x2E, 0x75, 0xB6);
- this.DisplayName = FormatName;
- }
- }
-
- [Export (typeof (EditorFormatDefinition))]
- [UserVisible (true)]
- [ClassificationType (ClassificationTypeNames = "CSS Comment")]
- [Name ("CSS Comment")]
- [Order (After = "HTML Priority Workaround", Before = LanguagePriority.FormalLanguage)]
- internal sealed class CommentClassificationFormat : ClassificationFormatDefinition
- {
- internal CommentClassificationFormat ()
- {
- ForegroundColor = Colors.DarkGreen;
- this.DisplayName = "CSS Comment";
- }
- }
-
- [Export (typeof (EditorFormatDefinition))]
- [UserVisible (true)]
- [ClassificationType (ClassificationTypeNames = "CSS Keyword")]
- [Name ("CSS Keyword")]
- [Order (After = "HTML Priority Workaround", Before = LanguagePriority.FormalLanguage)]
- internal sealed class KeywordClassificationFormat : ClassificationFormatDefinition
- {
- public KeywordClassificationFormat ()
- {
- ForegroundColor = Colors.Purple;
- this.DisplayName = "CSS Keyword";
- }
- }
-
- [Export (typeof (EditorFormatDefinition))]
- [UserVisible (true)]
- [ClassificationType (ClassificationTypeNames = "CSS Selector")]
- [Name ("CSS Selector")]
- [Order (After = "HTML Priority Workaround", Before = LanguagePriority.FormalLanguage)]
- internal sealed class SelectorClassificationFormat : ClassificationFormatDefinition
- {
- public SelectorClassificationFormat ()
- {
- ForegroundColor = Colors.Maroon;
- this.DisplayName = "CSS Selector";
- }
- }
-
- [Export (typeof (EditorFormatDefinition))]
- [UserVisible (true)]
- [ClassificationType (ClassificationTypeNames = "CSS Property Name")]
- [Name ("CSS Property Name")]
- [Order (After = "HTML Priority Workaround", Before = LanguagePriority.FormalLanguage)]
- internal sealed class CssPropertyNameClassificationFormat : ClassificationFormatDefinition
- {
- public CssPropertyNameClassificationFormat ()
- {
- ForegroundColor = Colors.Red;
- this.DisplayName = "CSS Property Name";
- }
- }
-
- [Export (typeof (EditorFormatDefinition))]
- [UserVisible (true)]
- [ClassificationType (ClassificationTypeNames = "CSS Property Value")]
- [Name ("CSS Property Value")]
- [Order (After = "HTML Priority Workaround", Before = LanguagePriority.FormalLanguage)]
- internal sealed class PropertyValueClassificationFormat : ClassificationFormatDefinition
- {
- public PropertyValueClassificationFormat ()
- {
- ForegroundColor = Colors.Blue;
- this.DisplayName = "CSS Property Value";
- }
- }
-
- [Export (typeof (EditorFormatDefinition))]
- [UserVisible (true)]
- [ClassificationType (ClassificationTypeNames = "CSS String Value")]
- [Name ("CSS String Value")]
- [Order (After = "HTML Priority Workaround", Before = LanguagePriority.FormalLanguage)]
- internal sealed class StringValueClassificationFormat : ClassificationFormatDefinition
- {
- internal StringValueClassificationFormat ()
- {
- ForegroundColor = Colors.Blue;
- this.DisplayName = "CSS String Value";
- }
- }
- }
-}
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/CodeLensPresenterStyle.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/CodeLensPresenterStyle.cs
deleted file mode 100644
index 4dc1d0d31c5..00000000000
--- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/CodeLensPresenterStyle.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// Copyright (c) Microsoft Corp. (https://www.microsoft.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System.ComponentModel.Composition;
-using System.Windows.Media;
-using Microsoft.VisualStudio.Language.Intellisense;
-using Microsoft.VisualStudio.Text.Formatting;
-using Microsoft.VisualStudio.Utilities;
-
-namespace MonoDevelop.TextEditor.Wpf
-{
- [Export(typeof(CodeLensPresenterStyle))]
- [Name("MonoDevelopCodeLensPresenterStyle")]
- [Order(Before = "default")]
- class MonoDevelopCodeLensPresenterStyle : CodeLensPresenterStyle
- {
- public MonoDevelopCodeLensPresenterStyle()
- {
- var blackBrush = new SolidColorBrush(Colors.Black);
- var whiteBrush = new SolidColorBrush(Colors.White);
-
- var typeface = new Typeface("Calibri");
- var size = 8.0 * 96.0 / 72.0;
-
- var textRunProperties = TextFormattingRunProperties.CreateTextFormattingRunProperties(
- foreground: blackBrush,
- background: null,
- typeface: typeface,
- size: size,
- textDecorations: null,
- textEffects: null,
- hintingSize: null,
- cultureInfo: null);
-
- this.IndicatorTextRunProperties = textRunProperties;
- this.IndicatorHoveredTextRunProperties = textRunProperties;
- this.IndicatorDisabledTextRunProperties = textRunProperties;
- this.IndicatorSeparatorBrush = blackBrush;
- this.PopupBackgroundBrush = whiteBrush;
- this.PopupTextBrush = blackBrush;
- this.PopupBorderBrush = blackBrush;
- }
- }
-}
\ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/FindUI.xaml b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/FindUI.xaml
deleted file mode 100644
index 96d1edbb213..00000000000
--- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/FindUI.xaml
+++ /dev/null
@@ -1,460 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/FindUI.xaml.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/FindUI.xaml.cs
deleted file mode 100644
index a3b4988a0ca..00000000000
--- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/FindUI.xaml.cs
+++ /dev/null
@@ -1,363 +0,0 @@
-//
-// Copyright (c) Microsoft Corp. (https://www.microsoft.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Input;
-using System.Windows.Threading;
-using Microsoft.VisualStudio.Text.Editor;
-using Microsoft.VisualStudio.Text.Operations;
-
-namespace MonoDevelop.TextEditor.Wpf.Find
-{
- public partial class FindUI : UserControl
- {
- private IWpfTextView currentTextView; // The text view on which the UI is being displayed at any given time
-
- ///
- /// Used for resizing of the control
- ///
- double _resizingBaselineWidth;
- double _resizingBaselinePoint;
-
- public event Action SearchTextChanged;
- public event Action ReplaceTextChanged;
- public event Action FindOptionsChanged;
- public event Action FindPrevious;
- public event Action FindNext;
- public event Action Replace;
- public event Action ReplaceAll;
- public event Action CloseRequested;
-
- public const string FindUIAdornmentLayer = nameof (FindUIAdornmentLayer);
-
- public FindUI ()
- {
- InitializeComponent ();
-
- Visibility = Visibility.Collapsed;
-
- SearchControl.TextChanged += OnSearchTextChanged;
- ReplaceControl.TextChanged += OnReplaceTextChanged;
-
- FindReplaceToggleButton.Checked += (s, e) => IsInReplaceMode = true;
- FindReplaceToggleButton.Unchecked += (s, e) => IsInReplaceMode = false;
- MatchCaseToggleButton.Checked += RaiseFindOptionsChanged;
- MatchCaseToggleButton.Unchecked += RaiseFindOptionsChanged;
- MatchWholeWordToggleButton.Checked += RaiseFindOptionsChanged;
- MatchWholeWordToggleButton.Unchecked += RaiseFindOptionsChanged;
- RegularExpressionToggleButton.Checked += RaiseFindOptionsChanged;
- RegularExpressionToggleButton.Unchecked += RaiseFindOptionsChanged;
-
- UpdateReplaceVisibility (false);
- }
-
- public void ShowAdornment (IWpfTextView view)
- {
- IAdornmentLayer adornmentLayer = view.GetAdornmentLayer (FindUIAdornmentLayer);
-
- // Make sure anti-aliasing doesn't cause trouble
- ((UIElement)adornmentLayer).SnapsToDevicePixels = true;
-
- currentTextView = view;
-
- if (adornmentLayer.Elements.Count == 0) {
- adornmentLayer.AddAdornment (AdornmentPositioningBehavior.OwnerControlled, null, this, this, null);
- }
-
- Position ();
-
- Visibility = Visibility.Visible;
-
- view.VisualElement.SizeChanged += OnViewSizeChanged;
- view.Closed += OnViewClosed;
-
- FocusFindBox ();
- }
-
- public void HideAdornment ()
- {
- IWpfTextView textView = currentTextView;
-
- // Send the focus back to the editor.
- if (textView != null && !textView.IsClosed) {
- textView.VisualElement.Focus ();
- }
-
- // Hide the adornment (Note that this calls DetachFromView on us)
- // This has to be done after the focus transfer because the FindAdornmentManager
- // needs to respond to the focus transfer before it disconnects itself from the view.
- Visibility = Visibility.Collapsed;
-
- if (textView != null) {
- if (this.IsKeyboardFocusWithin) {
- // This method will remove the Find UI adornment from the visual tree but that on its own
- // won't move the focus from the Find UI. WPF would later get around to restoring a valid focus.
- // There is a problematic case when the adornment is being hidden while doing a FindNext to
- // a document in a different top-level floating window frame because when we do try to focus
- // the other top-level window frame, WPF will detect that focus is still "disconnected"
- // and will restore focus to this editor instead of moving it as we request.
- // By manually moving focus here, it will not get into this "disconnected" state.
- textView.VisualElement.Focus ();
- }
-
- currentTextView = null;
-
- textView.GetAdornmentLayer (FindUIAdornmentLayer).RemoveAllAdornments ();
- textView.VisualElement.SizeChanged -= OnViewSizeChanged;
- textView.Closed -= OnViewClosed;
- textView = null;
- }
- }
-
- private void RaiseFindOptionsChanged (object sender, EventArgs args)
- {
- FindOptionsChanged?.Invoke (FindOptions);
- }
-
- public FindOptions FindOptions {
- get {
- var options = FindOptions.None;
- if (MatchCaseToggleButton.IsChecked == true) {
- options |= FindOptions.MatchCase;
- }
-
- if (MatchWholeWordToggleButton.IsChecked == true) {
- options |= FindOptions.WholeWord;
- }
-
- if (RegularExpressionToggleButton.IsChecked == true) {
- options |= FindOptions.UseRegularExpressions;
- }
-
- return options;
- }
- set {
- MatchCaseToggleButton.IsChecked = (value & FindOptions.MatchCase) != 0;
- MatchWholeWordToggleButton.IsChecked = (value & FindOptions.WholeWord) != 0;
- RegularExpressionToggleButton.IsChecked = (value & FindOptions.UseRegularExpressions) != 0;
- }
- }
-
- private bool isInReplaceMode;
- public bool IsInReplaceMode {
- get => isInReplaceMode;
- set {
- if (isInReplaceMode == value) {
- return;
- }
-
- isInReplaceMode = value;
- FindReplaceToggleButton.IsChecked = value;
- UpdateReplaceVisibility (value);
- }
- }
-
- private void UpdateReplaceVisibility (bool value)
- {
- var visibility = value ? Visibility.Visible : Visibility.Collapsed;
- ReplaceControlGroup.Visibility = visibility;
- ReplaceButtons.Visibility = visibility;
- }
-
- private void OnSearchTextChanged (object sender, TextChangedEventArgs e)
- {
- SearchTextChanged?.Invoke (SearchControl.Text);
- }
-
- private void OnReplaceTextChanged (object sender, TextChangedEventArgs e)
- {
- ReplaceTextChanged?.Invoke (ReplaceControl.Text);
- }
-
- private void OnFindPreviousClick (object sender, RoutedEventArgs args)
- {
- FindPrevious?.Invoke ();
- }
-
- private void OnFindNextClick (object sender, RoutedEventArgs args)
- {
- FindNext?.Invoke ();
- }
-
- private void OnReplaceNext (object sender, RoutedEventArgs e)
- {
- Replace?.Invoke ();
- e.Handled = true;
- }
-
- private void OnReplaceAll (object sender, RoutedEventArgs e)
- {
- ReplaceAll?.Invoke ();
- e.Handled = true;
- }
-
- private void OnMouseDown (object sender, MouseButtonEventArgs e)
- {
- // We don't want to allow the mouse click to go through to the editor.
- e.Handled = true;
- }
-
- private void OnMouseUp (object sender, MouseButtonEventArgs e)
- {
- // We don't want to allow the mouse click to go through to the editor.
- e.Handled = true;
- }
-
- private void OnGotKeyboardFocus (object sender, KeyboardFocusChangedEventArgs e)
- {
- // Don't let the GotKeyboardFocus event propagate to the parent. The text view, upon receipt of this event,
- // does some processing (among which is IME) and causes issues.
- e.Handled = true;
- }
-
- private void OnLostKeyboardFocus (object sender, KeyboardFocusChangedEventArgs e)
- {
- // Don't let the LostKeyboardFocus event propagate to the parent. The text view, upon receipt of this event,
- // does some processing (among which is IME) and causes issues.
- e.Handled = true;
- }
-
- private void OnResizerMouseLeftButtonDown (object sender, MouseButtonEventArgs e)
- {
- if (!this.Resizer.IsMouseCaptured) {
- _resizingBaselinePoint = this.PointToScreen (e.GetPosition (this)).X;
- _resizingBaselineWidth = this.ActualWidth;
-
- // While in the CaptureMouse call we can reentrantly get the MouseMove event so we
- // have to have initialized the point and width fields above before the call.
- if (!this.Resizer.CaptureMouse ()) {
- _resizingBaselinePoint = .0;
- _resizingBaselineWidth = .0;
- }
-
- e.Handled = true;
- }
- }
-
- private void OnResizerMouseLeftButtonUp (object sender, MouseButtonEventArgs e)
- {
- if (this.Resizer.IsMouseCaptured) {
- this.Resizer.ReleaseMouseCapture ();
- _resizingBaselinePoint = .0;
- _resizingBaselineWidth = .0;
- e.Handled = true;
- }
- }
-
- private void OnResizerMouseMove (object sender, MouseEventArgs e)
- {
- if (this.Resizer.IsMouseCaptured && e.LeftButton == MouseButtonState.Pressed) {
- Point mouseLocation = e.GetPosition (this);
- Point anchorPoint = this.PointFromScreen (new Point (_resizingBaselinePoint, .0));
- double delta = anchorPoint.X > mouseLocation.X ? anchorPoint.X - mouseLocation.X : -(mouseLocation.X - anchorPoint.X);
- this.Width = Math.Min (Math.Max (this.MinWidth, _resizingBaselineWidth + delta), this.MaxWidth);
-
- Canvas.SetTop (this, 0.0);
- Canvas.SetLeft (this, currentTextView.ViewportWidth - this.Width);
-
- e.Handled = true;
- }
- }
-
- private void OnHide (object sender, RoutedEventArgs e)
- {
- CloseRequested?.Invoke ();
- e.Handled = true;
- }
-
- private void OnViewClosed (object sender, EventArgs args)
- {
- this.HideAdornment ();
- }
-
- private void OnViewSizeChanged (object sender, SizeChangedEventArgs e)
- {
- if (e.WidthChanged) {
- Position ();
- }
- }
-
- public void Position ()
- {
- if (currentTextView != null) {
- this.MaxWidth = currentTextView.ViewportWidth;
- this.Width = Math.Min (Math.Max (this.Width, this.MinWidth), this.MaxWidth);
-
- Canvas.SetTop (this, 0.0);
- Canvas.SetLeft (this, currentTextView.ViewportWidth - this.Width);
- }
- }
-
- protected override void OnPreviewKeyDown (KeyEventArgs e)
- {
- if (e == null || e.Handled) {
- return;
- }
-
- // We handle the Escape key on preview so that we have the chance of handling it before any of the controls inside
- // the find adornment since we want to always dismiss the UI when escape is pressed irrespective of the state of
- // the child controls.
- base.OnPreviewKeyDown (e);
-
- if (e.Handled) {
- return;
- }
-
- if (e.Key == Key.Escape) {
- // If the search or replace controls have their pop up open, we want to let Escape take its normal
- // route so that it dismisses the popups. Also check whether a dropdown button has its context menu open.
- if (!InputManager.Current.IsInMenuMode) {
- CloseRequested?.Invoke ();
- e.Handled = true;
- }
- } else if (e.Key == Key.F3) {
- if (e.KeyboardDevice.Modifiers == ModifierKeys.None) {
- FindNext?.Invoke ();
- e.Handled = true;
- } else if (e.KeyboardDevice.Modifiers == ModifierKeys.Shift) {
- FindPrevious?.Invoke ();
- e.Handled = true;
- }
- } else if (e.Key == Key.A && e.KeyboardDevice.Modifiers == ModifierKeys.Alt) {
- ReplaceAll?.Invoke ();
- e.Handled = true;
- } else if (e.Key == Key.R && e.KeyboardDevice.Modifiers == ModifierKeys.Alt) {
- Replace?.Invoke ();
- e.Handled = true;
- }
- }
-
- private void OnIsVisibleChanged (object sender, DependencyPropertyChangedEventArgs e)
- {
- if ((bool)e.NewValue) {
- this.Position ();
- }
- }
-
- public void FocusFindBox ()
- {
- Dispatcher.BeginInvoke (new Action (() => this.SearchControl.Focus ()), DispatcherPriority.Input);
- }
- }
-}
-
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/WpfFindPresenter.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/WpfFindPresenter.cs
deleted file mode 100644
index ce8ec3dfe4b..00000000000
--- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/WpfFindPresenter.cs
+++ /dev/null
@@ -1,172 +0,0 @@
-//
-// Copyright (c) Microsoft Corp. (https://www.microsoft.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using Microsoft.VisualStudio.Text.Editor;
-using Microsoft.VisualStudio.Text.Operations;
-using Microsoft.VisualStudio.Text.Find;
-using Microsoft.VisualStudio.Text.Find.Implementation;
-using Microsoft.VisualStudio.Text.Editor.Commanding;
-using Microsoft.VisualStudio.Text.Editor.Commanding.Commands;
-
-namespace MonoDevelop.TextEditor.Wpf.Find
-{
- class WpfFindPresenter : IFindPresenter
- {
- readonly WpfFindPresenterFactory factory;
- readonly ITextView textView;
- readonly FindUI findUI;
- readonly IEditorCommandHandlerService commandHandlerService;
- FindController controller;
-
- static Action Noop { get; } = () => { };
- FindBroker Broker => factory.FindBroker;
-
- public WpfFindPresenter (WpfFindPresenterFactory factory, ITextView textView)
- {
- this.factory = factory;
- this.textView = textView;
- this.findUI = new FindUI ();
- this.commandHandlerService = factory.EditorCommandHandlerServiceFactory.GetService (textView);
-
- SubscribeToUIEvents ();
- }
-
- ///
- /// Controller is lazy to avoid a MEF loop
- ///
- FindController Controller {
- get {
- if (controller == null) {
- controller = Broker.GetFindController (textView);
- SubscribeToControllerEvents ();
- }
-
- return controller;
- }
- }
-
- public bool IsVisible => findUI.IsVisible;
-
- public bool IsFocused => findUI.IsKeyboardFocusWithin;
-
- public void ShowFind ()
- {
- findUI.ShowAdornment ((IWpfTextView)textView);
- findUI.IsInReplaceMode = false;
- Controller.UpdateSearchTextFromCurrentWord ();
- }
-
- public void ShowReplace ()
- {
- findUI.ShowAdornment ((IWpfTextView)textView);
- findUI.IsInReplaceMode = true;
- Controller.UpdateSearchTextFromCurrentWord ();
- }
-
- public void Hide ()
- {
- findUI.HideAdornment ();
- Controller.ClearTags ();
- }
-
- void SubscribeToUIEvents ()
- {
- findUI.CloseRequested += Hide;
- findUI.SearchTextChanged += OnSearchTextChangedInUI;
- findUI.ReplaceTextChanged += OnReplaceTextChangedInUI;
- findUI.FindOptionsChanged += OnFindOptionsChangedInUI;
- findUI.FindPrevious += OnFindPreviousClicked;
- findUI.FindNext += OnFindNextClicked;
- findUI.Replace += OnReplaceClicked;
- findUI.ReplaceAll += OnReplaceAllClicked;
- }
-
- void SubscribeToControllerEvents ()
- {
- controller.ResultsAvailable += OnResultsAvailable;
- controller.FindOptionsChanged += OnFindOptionsChanged;
- controller.SearchTextChanged += OnSearchTextChanged;
- }
-
- void OnSearchTextChanged ()
- {
- if (findUI.SearchControl.Text != controller.SearchText) {
- findUI.SearchControl.Text = controller.SearchText;
- findUI.SearchControl.SelectAll ();
- }
- }
-
- void OnResultsAvailable ((int index, int count) args)
- {
- string summaryText = null;
- if (args.count == 0) {
- summaryText = "No results";
- } else {
- summaryText = $"{args.index + 1} of {args.count}";
- }
-
- findUI.Dispatcher.InvokeAsync (() => {
- findUI.ResultIndexAndCount.Text = summaryText;
- });
- }
-
- void OnFindOptionsChanged ()
- {
- findUI.FindOptions = Broker.FindOptions;
- }
-
- void OnFindPreviousClicked ()
- {
- commandHandlerService.Execute ((v, b) => new FindPreviousCommandArgs (v, b), Noop);
- }
-
- void OnFindNextClicked ()
- {
- commandHandlerService.Execute ((v, b) => new FindNextCommandArgs (v, b), Noop);
- }
-
- void OnReplaceClicked ()
- {
- commandHandlerService.Execute ((v, b) => new ReplaceNextCommandArgs (v, b), Noop);
- }
-
- void OnReplaceAllClicked ()
- {
- commandHandlerService.Execute ((v, b) => new ReplaceAllCommandArgs (v, b), Noop);
- }
-
- void OnFindOptionsChangedInUI (FindOptions findOptions)
- {
- Broker.FindOptions = findOptions;
- }
-
- void OnSearchTextChangedInUI (string text)
- {
- Controller.SearchText = text;
- }
-
- void OnReplaceTextChangedInUI (string text)
- {
- Controller.ReplaceText = text;
- }
- }
-}
\ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/WpfFindPresenterFactory.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/WpfFindPresenterFactory.cs
deleted file mode 100644
index 4f6b1e7cc2d..00000000000
--- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Find/WpfFindPresenterFactory.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-//
-// Copyright (c) Microsoft Corp. (https://www.microsoft.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.Text.Editor;
-using Microsoft.VisualStudio.Text.Editor.Commanding;
-using Microsoft.VisualStudio.Text.Find;
-using Microsoft.VisualStudio.Text.Find.Implementation;
-using Microsoft.VisualStudio.Utilities;
-
-namespace MonoDevelop.TextEditor.Wpf.Find
-{
- [Export (typeof (IFindPresenterFactory))]
- class WpfFindPresenterFactory : IFindPresenterFactory
- {
- [Import]
- public FindBroker FindBroker { get; set; }
-
- [Import]
- public IEditorCommandHandlerServiceFactory EditorCommandHandlerServiceFactory { get; set; }
-
- public IFindPresenter TryGetFindPresenter (ITextView textView)
- {
- return textView.Properties.GetOrCreateSingletonProperty (() =>
- {
- var presenter = new WpfFindPresenter (this, textView);
- return presenter;
- });
- }
-
- [Export]
- [Name (FindUI.FindUIAdornmentLayer)]
- [Order (After = PredefinedAdornmentLayers.Caret)]
- [IsOverlayLayer (true)]
- private AdornmentLayerDefinition adornmentLayerDefinition;
- }
-}
\ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/KeyProcessor/DefaultKeyProcessor.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/KeyProcessor/DefaultKeyProcessor.cs
deleted file mode 100644
index daea6c8986a..00000000000
--- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/KeyProcessor/DefaultKeyProcessor.cs
+++ /dev/null
@@ -1,422 +0,0 @@
-//
-// Copyright (c) Microsoft Corp. (https://www.microsoft.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using System.Windows.Input;
-using Microsoft.VisualStudio.Commanding;
-using Microsoft.VisualStudio.Text;
-using Microsoft.VisualStudio.Text.Editor;
-using Microsoft.VisualStudio.Text.Editor.Commanding;
-using Microsoft.VisualStudio.Text.Editor.Commanding.Commands;
-using Microsoft.VisualStudio.Text.Editor.OptionsExtensionMethods;
-using Microsoft.VisualStudio.Text.Operations;
-
-namespace MonoDevelop.Ide.Text
-{
- sealed class DefaultKeyProcessor : KeyProcessor
- {
- readonly IWpfTextView _textView;
- readonly IEditorOperations _editorOperations;
- readonly ITextUndoHistoryRegistry _undoHistoryRegistry;
- readonly IEditorCommandHandlerService _editorCommandHandlerService;
-
- static Func Unspecified { get; } = () => CommandState.Unspecified;
- static Action Noop { get; } = () => { };
-
- internal DefaultKeyProcessor (
- IWpfTextView textView,
- IEditorOperations editorOperations,
- ITextUndoHistoryRegistry undoHistoryRegistry,
- IEditorCommandHandlerService editorCommandHandlerService)
- {
- this._textView = textView;
- this._editorOperations = editorOperations;
- this._undoHistoryRegistry = undoHistoryRegistry;
- this._editorCommandHandlerService = editorCommandHandlerService;
- }
-
- public void QueryAndExecute (Func argsFactory) where T : EditorCommandArgs
- {
- var state = _editorCommandHandlerService.GetCommandState (argsFactory, Unspecified);
- if (state.IsAvailable)
- _editorCommandHandlerService.Execute (argsFactory, Noop);
- }
-
- public override void KeyDown (KeyEventArgs args)
- {
- if (args.Handled) {
- return;
- }
-
- args.Handled = true;
- switch (args.KeyboardDevice.Modifiers) {
- case ModifierKeys.None:
- HandleKey (args);
- break;
- case ModifierKeys.Control:
- HandleControlKey (args);
- break;
- case ModifierKeys.Alt:
- HandleAltKey (args);
- break;
- case ModifierKeys.Shift | ModifierKeys.Alt:
- HandleAltShiftKey (args);
- break;
- case ModifierKeys.Control | ModifierKeys.Shift:
- HandleControlShiftKey (args);
- break;
- case ModifierKeys.Shift:
- HandleShiftKey (args);
- break;
- case ModifierKeys.Control | ModifierKeys.Alt:
- HandleAltControlKey (args);
- break;
- default:
- args.Handled = false;
- break;
- }
- }
-
- private void HandleAltControlKey (KeyEventArgs args)
- {
- switch (args.Key) {
- case Key.Home:
- _editorOperations.MoveCurrentLineToTop ();
- break;
- case Key.End:
- _editorOperations.MoveCurrentLineToBottom ();
- break;
- case Key.Space:
- QueryAndExecute ((v, b) => new ToggleCompletionModeCommandArgs (v, b));
- break;
- default:
- args.Handled = false;
- break;
- }
- }
-
- private void HandleShiftKey (KeyEventArgs args)
- {
- switch (args.Key) {
- case Key.Back:
- QueryAndExecute ((v, b) => new BackspaceKeyCommandArgs (v, b));
- break;
- case Key.Right:
- _editorOperations.MoveToNextCharacter (extendSelection: true);
- break;
- case Key.Left:
- _editorOperations.MoveToPreviousCharacter (extendSelection: true);
- break;
- case Key.Up:
- _editorOperations.MoveLineUp (extendSelection: true);
- break;
- case Key.Down:
- _editorOperations.MoveLineDown (extendSelection: true);
- break;
- case Key.Home:
- QueryAndExecute ((v, b) => new LineStartExtendCommandArgs (v, b));
- break;
- case Key.End:
- QueryAndExecute ((v, b) => new LineEndExtendCommandArgs (v, b));
- break;
- case Key.PageUp:
- _editorOperations.PageUp (extendSelection: true);
- break;
- case Key.PageDown:
- _editorOperations.PageDown (extendSelection: true);
- break;
- case Key.Tab:
- QueryAndExecute ((v, b) => new BackTabKeyCommandArgs (v, b));
- break;
- case Key.Enter:
- QueryAndExecute ((v, b) => new ReturnKeyCommandArgs (v, b));
- break;
- default:
- args.Handled = false;
- break;
- }
- }
-
- private void HandleControlShiftKey (KeyEventArgs args)
- {
- switch (args.Key) {
- case Key.Right:
- _editorOperations.MoveToNextWord (extendSelection: true);
- break;
- case Key.Left:
- _editorOperations.MoveToPreviousWord (extendSelection: true);
- break;
- case Key.Home:
- _editorOperations.MoveToStartOfDocument (extendSelection: true);
- break;
- case Key.End:
- _editorOperations.MoveToEndOfDocument (extendSelection: true);
- break;
- case Key.U:
- args.Handled = this.PerformEditAction (() => _editorOperations.MakeUppercase ());
- break;
- default:
- args.Handled = false;
- break;
- }
- }
-
- private void HandleAltShiftKey (KeyEventArgs args)
- {
- if (args.Key == Key.T) {
- args.Handled = this.PerformEditAction (() => _editorOperations.TransposeLine ());
- return;
- }
-
- // If this is starting a new selection, put the selection in
- // box selection mode.
- if ((args.Key == Key.Down ||
- args.Key == Key.Up ||
- args.Key == Key.Left ||
- args.Key == Key.Right) &&
- _textView.Selection.IsEmpty) {
- _textView.Selection.Mode = TextSelectionMode.Box;
- }
-
- // Treat it as a regular Shift + keypress
- HandleShiftKey (args);
- }
-
- private void HandleAltKey (KeyEventArgs args)
- {
- switch (args.Key) {
- case Key.Left:
- _editorOperations.SelectEnclosing ();
- break;
- case Key.Right:
- _editorOperations.SelectFirstChild ();
- break;
- case Key.Down:
- _editorOperations.SelectNextSibling (extendSelection: false);
- break;
- case Key.Up:
- _editorOperations.SelectPreviousSibling (extendSelection: false);
- break;
- default:
- args.Handled = false;
- break;
- }
- }
-
- private void HandleControlKey (KeyEventArgs args)
- {
- switch (args.Key) {
- case Key.Space:
- QueryAndExecute ((v, b) => new CommitUniqueCompletionListItemCommandArgs (v, b));
- break;
- case Key.Back:
- QueryAndExecute ((v, b) => new WordDeleteToStartCommandArgs (v, b));
- break;
- case Key.Delete:
- QueryAndExecute ((v, b) => new WordDeleteToEndCommandArgs (v, b));
- break;
- case Key.A:
- QueryAndExecute ((v, b) => new SelectAllCommandArgs (v, b));
- break;
- case Key.F:
- QueryAndExecute ((v, b) => new FindCommandArgs (v, b));
- break;
- case Key.H:
- QueryAndExecute ((v, b) => new ReplaceCommandArgs (v, b));
- break;
- case Key.W:
- _editorOperations.SelectCurrentWord ();
- break;
- case Key.Right:
- _editorOperations.MoveToNextWord (extendSelection: false);
- break;
- case Key.Left:
- _editorOperations.MoveToPreviousWord (extendSelection: false);
- break;
- case Key.Home:
- QueryAndExecute ((v, b) => new DocumentStartCommandArgs (v, b));
- break;
- case Key.End:
- QueryAndExecute ((v, b) => new DocumentEndCommandArgs (v, b));
- break;
- case Key.Up:
- _editorOperations.ScrollUpAndMoveCaretIfNecessary ();
- break;
- case Key.Down:
- _editorOperations.ScrollDownAndMoveCaretIfNecessary ();
- break;
- case Key.T:
- args.Handled = this.PerformEditAction (() => _editorOperations.TransposeCharacter ());
- break;
- case Key.U:
- args.Handled = this.PerformEditAction (() => _editorOperations.MakeLowercase ());
- break;
- case Key.C:
- QueryAndExecute ((v, b) => new CopyCommandArgs (v, b));
- break;
- case Key.X:
- QueryAndExecute ((v, b) => new CutCommandArgs (v, b));
- break;
- case Key.V:
- QueryAndExecute ((v, b) => new PasteCommandArgs (v, b));
- break;
- case Key.Z:
- if (UndoHistory.CanUndo)
- QueryAndExecute ((v, b) => new UndoCommandArgs (v, b));
- else
- args.Handled = false;
- break;
- case Key.Y:
- if (UndoHistory.CanRedo)
- QueryAndExecute ((v, b) => new RedoCommandArgs (v, b));
- else
- args.Handled = false;
- break;
- default:
- args.Handled = false;
- break;
- }
- }
-
- private void HandleKey (KeyEventArgs args)
- {
- switch (args.Key) {
- case Key.Right:
- QueryAndExecute ((v, b) => new RightKeyCommandArgs (v, b));
- break;
- case Key.Left:
- QueryAndExecute ((v, b) => new LeftKeyCommandArgs (v, b));
- break;
- case Key.Up:
- QueryAndExecute ((v, b) => new UpKeyCommandArgs (v, b));
- break;
- case Key.Down:
- QueryAndExecute ((v, b) => new DownKeyCommandArgs (v, b));
- break;
- case Key.PageUp:
- QueryAndExecute ((v, b) => new PageUpKeyCommandArgs (v, b));
- break;
- case Key.PageDown:
- QueryAndExecute ((v, b) => new PageDownKeyCommandArgs (v, b));
- break;
- case Key.Home:
- QueryAndExecute ((v, b) => new LineStartCommandArgs (v, b));
- break;
- case Key.End:
- QueryAndExecute ((v, b) => new LineEndCommandArgs (v, b));
- break;
- case Key.Escape:
- QueryAndExecute ((v, b) => new EscapeKeyCommandArgs (v, b));
- break;
- case Key.Delete:
- QueryAndExecute ((v, b) => new DeleteKeyCommandArgs (v, b));
- break;
- case Key.Back:
- QueryAndExecute ((v, b) => new BackspaceKeyCommandArgs (v, b));
- break;
- case Key.Insert:
- _editorOperations.Options.SetOptionValue (DefaultTextViewOptions.OverwriteModeId,
- !_editorOperations.Options.IsOverwriteModeEnabled ());
- break;
- case Key.Enter:
- QueryAndExecute ((v, b) => new ReturnKeyCommandArgs (v, b));
- break;
- case Key.Tab:
- QueryAndExecute ((v, b) => new TabKeyCommandArgs (v, b));
- break;
- case Key.F2:
- QueryAndExecute ((v, b) => new RenameCommandArgs (v, b));
- break;
- default:
- args.Handled = false;
- break;
- }
- }
-
- public override void TextInput (TextCompositionEventArgs args)
- {
- if (args.Text.Length == 1) {
- QueryAndExecute ((v, b) => new TypeCharCommandArgs (v, b, args.Text[0]));
- args.Handled = true;
- }
- }
-
- public override void TextInputStart (TextCompositionEventArgs args)
- {
- if (args.TextComposition is ImeTextComposition) {
- // This TextInputStart message is part of an IME event and needs to be treated like
- // provisional text input (if the cast failed, then an IME is not the source of the
- // text input and we can rely on getting an identical TextInput event as soon as we
- // exit).
- this.HandleProvisionalImeInput (args);
- }
- }
-
- public override void TextInputUpdate (TextCompositionEventArgs args)
- {
- if (args.TextComposition is ImeTextComposition) {
- this.HandleProvisionalImeInput (args);
- } else {
- args.Handled = false;
- }
- }
-
- private void HandleProvisionalImeInput (TextCompositionEventArgs args)
- {
- if (args.Text.Length > 0) {
- args.Handled = this.PerformEditAction (() => _editorOperations.InsertProvisionalText (args.Text));
-
- if (args.Handled) {
- _textView.Caret.EnsureVisible ();
- }
- }
- }
-
- ///
- /// Performs the passed editAction if the view does not prohibit user input.
- ///
- /// True if the editAction was performed.
- private bool PerformEditAction (Action editAction)
- {
- if (!_textView.Options.GetOptionValue (DefaultTextViewOptions.ViewProhibitUserInputId)) {
- editAction.Invoke ();
- return true;
- }
-
- return false;
- }
-
- private ITextUndoHistory UndoHistory {
- get {
- return _undoHistoryRegistry.GetHistory (_textView.TextBuffer);
- }
- }
- }
-}
-
-// TODO:
-// InvokeCompletionList
-// InvokeSignatureHelp
-// InsertSnippet
-// MoveSelectedLinesUp
-// MoveSelectedLinesDown
-// Rename
-// SurroundWith
\ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/KeyProcessor/DefaultKeyProcessorProvider.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/KeyProcessor/DefaultKeyProcessorProvider.cs
deleted file mode 100644
index ac9ff751214..00000000000
--- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/KeyProcessor/DefaultKeyProcessorProvider.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// Copyright (c) Microsoft Corp. (https://www.microsoft.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using System.ComponentModel.Composition;
-using Microsoft.VisualStudio.Text.Editor;
-using Microsoft.VisualStudio.Text.Editor.Commanding;
-using Microsoft.VisualStudio.Text.Operations;
-using Microsoft.VisualStudio.Utilities;
-
-namespace MonoDevelop.Ide.Text
-{
- [Export(typeof(IKeyProcessorProvider))]
- [Name("DefaultKeyProcessor")]
- [ContentType("text")]
- [TextViewRole(PredefinedTextViewRoles.Interactive)]
- internal sealed class DefaultKeyProcessorProvider : IKeyProcessorProvider
- {
- [Import]
- private IEditorOperationsFactoryService editorOperationsProvider = null;
-
- [Import]
- private IEditorCommandHandlerServiceFactory editorCommandHandlerServiceFactory = null;
-
- [Import]
- private ITextUndoHistoryRegistry textUndoHistoryRegistry = null;
-
- ///
- /// Creates a new key processor provider for the given WPF text view host
- ///
- /// WPF-based text view to create key processor for
- /// A valid key processor
- public KeyProcessor GetAssociatedProcessor(IWpfTextView wpfTextView)
- {
- if (wpfTextView == null)
- {
- throw new ArgumentNullException(nameof(wpfTextView));
- }
-
- return new DefaultKeyProcessor(
- wpfTextView,
- editorOperationsProvider.GetEditorOperations(wpfTextView),
- textUndoHistoryRegistry,
- editorCommandHandlerServiceFactory.GetService(wpfTextView));
- }
- }
-}
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/MonoDevelop.TextEditor.Wpf.csproj b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/MonoDevelop.TextEditor.Wpf.csproj
deleted file mode 100644
index 10b27ece697..00000000000
--- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/MonoDevelop.TextEditor.Wpf.csproj
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
- MonoDevelop WPF Text Editor
- Integrates the WPF version of the Visual Studio Editor into MonoDevelop
- DisplayBindings\TextEditor.Wpf
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Designer
- MSBuild:Compile
-
-
-
-
- FindUI.xaml
-
-
-
-
-
\ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/MonoDevelopTracer.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/MonoDevelopTracer.cs
deleted file mode 100644
index 66b33c472aa..00000000000
--- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/MonoDevelopTracer.cs
+++ /dev/null
@@ -1,241 +0,0 @@
-//
-// Copyright (c) Microsoft Corp. (https://www.microsoft.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using System.Diagnostics;
-using MonoDevelop.Core;
-
-namespace MonoDevelop.TextEditor
-{
- class MonoDevelopTracer : Microsoft.VisualStudio.Utilities.ITracer
- {
- public MonoDevelopTracer (string name, SourceLevels level = SourceLevels.Warning)
- {
- Source = new TraceSource (name);
- Level = level;
- }
-
- public TraceSource Source { get; }
-
- public SourceLevels Level { get; set; }
-
- public int IndentLevel => 0;
-
- public IDisposable Indent (int count = 1)
- {
- return null;
- }
-
- public bool ShouldTrace (TraceEventType eventType)
- {
- switch (eventType) {
- case TraceEventType.Critical:
- return Level.HasFlag (SourceLevels.Critical);
- case TraceEventType.Error:
- return Level.HasFlag (SourceLevels.Error);
- case TraceEventType.Warning:
- return Level.HasFlag (SourceLevels.Warning);
- case TraceEventType.Information:
- return Level.HasFlag (SourceLevels.Information);
- case TraceEventType.Verbose:
- return Level.HasFlag (SourceLevels.Verbose);
- }
- return false;
- }
-
- public void Trace (TraceEventType eventType, string message)
- {
- if (ShouldTrace (eventType)) {
- switch (eventType) {
- case TraceEventType.Critical:
- LoggingService.LogFatalError (message);
- break;
- case TraceEventType.Error:
- LoggingService.LogError (message);
- break;
- case TraceEventType.Warning:
- LoggingService.LogWarning (message);
- break;
- case TraceEventType.Information:
- LoggingService.LogInfo (message);
- break;
- case TraceEventType.Verbose:
- LoggingService.LogDebug (message);
- break;
- }
- }
- }
-
- public void Trace (TraceEventType eventType, string message, object arg0)
- {
- if (ShouldTrace (eventType)) {
- switch (eventType) {
- case TraceEventType.Critical:
- LoggingService.LogFatalError (message, arg0);
- break;
- case TraceEventType.Error:
- LoggingService.LogError (message, arg0);
- break;
- case TraceEventType.Warning:
- LoggingService.LogWarning (message, arg0);
- break;
- case TraceEventType.Information:
- LoggingService.LogInfo (message, arg0);
- break;
- case TraceEventType.Verbose:
- LoggingService.LogDebug (message, arg0);
- break;
- }
- }
- }
-
- public void Trace (TraceEventType eventType, string message, object arg0, object arg1)
- {
- if (ShouldTrace (eventType)) {
- switch (eventType) {
- case TraceEventType.Critical:
- LoggingService.LogFatalError (message, arg0, arg1);
- break;
- case TraceEventType.Error:
- LoggingService.LogError (message, arg0, arg1);
- break;
- case TraceEventType.Warning:
- LoggingService.LogWarning (message, arg0, arg1);
- break;
- case TraceEventType.Information:
- LoggingService.LogInfo (message, arg0, arg1);
- break;
- case TraceEventType.Verbose:
- LoggingService.LogDebug (message, arg0, arg1);
- break;
- }
- }
- }
-
- public void Trace (TraceEventType eventType, string message, params object[] args)
- {
- if (ShouldTrace (eventType)) {
- switch (eventType) {
- case TraceEventType.Critical:
- LoggingService.LogFatalError (message, args);
- break;
- case TraceEventType.Error:
- LoggingService.LogError (message, args);
- break;
- case TraceEventType.Warning:
- LoggingService.LogWarning (message, args);
- break;
- case TraceEventType.Information:
- LoggingService.LogInfo (message, args);
- break;
- case TraceEventType.Verbose:
- LoggingService.LogDebug (message, args);
- break;
- }
- }
- }
-
- public void TraceError (string message)
- {
- LoggingService.LogError (message);
- }
-
- public void TraceError (string message, object arg0)
- {
- LoggingService.LogError (message, arg0);
- }
-
- public void TraceError (string message, object arg0, object arg1)
- {
- LoggingService.LogError (message, arg0, arg1);
- }
-
- public void TraceError (string message, params object[] args)
- {
- LoggingService.LogError (message, args);
- }
-
- public void TraceException (Exception ex, TraceEventType eventType = TraceEventType.Error)
- {
- LoggingService.LogError (Source.Name, ex);
- }
-
- public void TraceInformation (string message)
- {
- LoggingService.LogInfo (message);
- }
-
- public void TraceInformation (string message, object arg0)
- {
- LoggingService.LogInfo (message, arg0);
- }
-
- public void TraceInformation (string message, object arg0, object arg1)
- {
- LoggingService.LogInfo (message, arg0, arg1);
- }
-
- public void TraceInformation (string message, params object[] args)
- {
- LoggingService.LogInfo (message, args);
- }
-
- public void TraceVerbose (string message)
- {
- LoggingService.LogDebug (message);
- }
-
- public void TraceVerbose (string message, object arg0)
- {
- LoggingService.LogDebug (message, arg0);
- }
-
- public void TraceVerbose (string message, object arg0, object arg1)
- {
- LoggingService.LogDebug (message, arg1);
- }
-
- public void TraceVerbose (string message, params object[] args)
- {
- LoggingService.LogDebug (message, args);
- }
-
- public void TraceWarning (string message)
- {
- LoggingService.LogWarning (message);
- }
-
- public void TraceWarning (string message, object arg0)
- {
- LoggingService.LogWarning (message, arg0);
- }
-
- public void TraceWarning (string message, object arg0, object arg1)
- {
- LoggingService.LogWarning (message, arg0, arg1);
- }
-
- public void TraceWarning (string message, params object[] args)
- {
- LoggingService.LogWarning (message, args);
- }
- }
-}
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Properties/AddinInfo.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Properties/AddinInfo.cs
deleted file mode 100644
index cf779fbb00b..00000000000
--- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Properties/AddinInfo.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// Copyright (c) Microsoft Corp. (https://www.microsoft.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using Mono.Addins;
-using Mono.Addins.Description;
-
-[assembly:Addin ("TextEditor.Wpf",
- Namespace = "MonoDevelop",
- Version = MonoDevelop.BuildInfo.Version,
- Category = "MonoDevelop Core")]
-
-[assembly:AddinName ("MonoDevelop Text Editor")]
-[assembly:AddinDescription ("Integrates the Visual Studio text editor")]
-[assembly: AddinFlags (AddinFlags.Hidden)]
-
-[assembly:AddinDependency ("Core", MonoDevelop.BuildInfo.Version)]
-[assembly:AddinDependency ("Ide", MonoDevelop.BuildInfo.Version)]
-[assembly:AddinDependency ("Debugger", MonoDevelop.BuildInfo.Version)]
-[assembly:AddinDependency ("DesignerSupport", MonoDevelop.BuildInfo.Version)]
-[assembly:AddinDependency ("Refactoring", MonoDevelop.BuildInfo.Version)]
-[assembly: AddinDependency ("TextEditor", MonoDevelop.BuildInfo.Version)]
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Properties/MonoDevelop.TextEditor.Wpf.addin.xml b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Properties/MonoDevelop.TextEditor.Wpf.addin.xml
deleted file mode 100644
index 1c3c298df37..00000000000
--- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Properties/MonoDevelop.TextEditor.Wpf.addin.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/RootWpfWidget.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/RootWpfWidget.cs
deleted file mode 100644
index 854c01c9037..00000000000
--- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/RootWpfWidget.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// Copyright (c) Microsoft Corp. (https://www.microsoft.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using MonoDevelop.Components.Windows;
-using System.Windows.Controls;
-
-namespace MonoDevelop.TextEditor
-{
- class RootWpfWidget : GtkWPFWidget
- {
- public RootWpfWidget (Control control) : base(control)
- {
- }
-
- protected override void RepositionWpfWindow ()
- {
- var scale = MonoDevelop.Components.GtkWorkarounds.GetScaleFactor (this);
- RepositionWpfWindow (scale, scale);
- }
- }
-}
\ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoHistory.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoHistory.cs
deleted file mode 100644
index acf9ecd7a11..00000000000
--- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoHistory.cs
+++ /dev/null
@@ -1,267 +0,0 @@
-//
-// Copyright (c) Microsoft Corp. (https://www.microsoft.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using Microsoft.VisualStudio.Text.Operations;
-using Microsoft.VisualStudio.Utilities;
-using Microsoft.VisualStudio.Text.Editor;
-
-namespace MonoDevelop.Ide.Text
-{
- ///
- /// Provides a very simple ITextUndoHistory implementation.
- ///
- internal sealed class UndoHistory : ITextUndoHistory
- {
- private readonly Stack _openTransactionStack = new Stack();
- private readonly Stack _undoStack = new Stack();
- private readonly Stack _redoStack = new Stack();
- private readonly PropertyCollection _properties = new PropertyCollection();
- private TextUndoHistoryState _state = TextUndoHistoryState.Idle;
- private event EventHandler _undoRedoHappened;
- private event EventHandler _undoTransactionCompleted;
-
- internal ITextUndoTransaction CurrentTransaction
- {
- get { return _openTransactionStack.Count > 0 ? _openTransactionStack.Peek() : null; }
- }
-
- internal Stack UndoStack => _undoStack;
-
- internal Stack RedoStack => _redoStack;
-
- internal object Context { get; }
-
- internal UndoHistory(object context) => Context = context;
-
- internal ITextUndoTransaction CreateTransaction(string description)
- {
- _openTransactionStack.Push(new UndoTransaction(this, description));
- return _openTransactionStack.Peek();
- }
-
- internal void Redo(int count)
- {
- try
- {
- count = Math.Min(_redoStack.Count, count);
- _state = TextUndoHistoryState.Redoing;
- for (var i = 0; i < count; i++)
- {
- var current = _redoStack.Peek();
- if (!current.CanRedo)
- {
- throw new InvalidOperationException();
- }
-
- _redoStack.Pop();
- current.Do();
- _undoStack.Push(current);
- }
-
- RaiseUndoRedoHappened();
- }
- finally
- {
- _state = TextUndoHistoryState.Idle;
- }
- }
-
- internal void Undo(int count)
- {
- try
- {
- count = Math.Min(_undoStack.Count, count);
- _state = TextUndoHistoryState.Undoing;
- for (var i = 0; i < count; i++)
- {
- var current = _undoStack.Peek();
- if (!current.CanUndo)
- {
- throw new InvalidOperationException();
- }
- _undoStack.Pop();
- current.Undo();
- _redoStack.Push(current);
-
- RaiseUndoRedoHappened();
- }
- }
- finally
- {
- _state = TextUndoHistoryState.Idle;
- }
- }
-
- internal void OnTransactionClosed(UndoTransaction transaction, bool didComplete)
- {
- if (_openTransactionStack.Count == 0 || transaction != _openTransactionStack.Peek())
- {
- // Happens in dispose after complete / cancel
- return;
- }
-
- _openTransactionStack.Pop();
- if (!didComplete)
- {
- return;
- }
-
- if (_openTransactionStack.Count == 0)
- {
- OnTransactionStackCompleted(transaction);
- }
- else
- {
- var top = _openTransactionStack.Peek();
- foreach (var cur in transaction.UndoPrimitives)
- {
- top.AddUndo(cur);
- }
-
- transaction.UndoPrimitives.Clear();
- }
- }
-
- private void OnTransactionStackCompleted(UndoTransaction transaction)
- {
- Debug.Assert(_openTransactionStack.Count == 0);
-
- ITextUndoTransaction eventArgument = transaction;
- var result = TextUndoTransactionCompletionResult.TransactionAdded;
- if (_undoStack.Count > 0)
- {
- var previous = _undoStack.Peek();
- if (transaction.MergePolicy != null &&
- previous.MergePolicy != null &&
- previous.MergePolicy.TestCompatiblePolicy(transaction.MergePolicy) &&
- previous.MergePolicy.CanMerge(newerTransaction: transaction, olderTransaction: previous))
- {
- eventArgument = previous;
- previous.MergePolicy.PerformTransactionMerge(existingTransaction: previous, newTransaction: transaction);
- }
- else
- {
- _undoStack.Push(transaction);
- }
- }
- else
- {
- _undoStack.Push(transaction);
- }
-
- _undoTransactionCompleted?.Invoke(this, new TextUndoTransactionCompletedEventArgs(eventArgument, result));
- }
-
- internal void Clear()
- {
- if (_state != TextUndoHistoryState.Idle || CurrentTransaction != null)
- {
- throw new InvalidOperationException("Can't clear with an open transaction or in undo / redo");
- }
-
- _undoStack.Clear();
- _redoStack.Clear();
-
- // The IEditorOperations AddAfterTextBufferChangePrimitive and AddBeforeTextBufferChangePrimitive
- // implementations store an ITextView in the Property of the associated ITextUndoHistory. It's
- // necessary to keep this value present so long as the primitives are in the undo / redo stack
- // as their implementation depends on it. Once the stack is cleared we can safely remove
- // the value.
- //
- // This is in fact necessary for sane testing. Without this removal it's impossible to have
- // an ITextView disconnect and be collected from it's underlying ITextBuffer. The ITextUndoHistory
- // is associated with an ITextBuffer and through it's undo stack will keep the ITextView alive
- // indefinitely
- _properties.RemoveProperty(typeof(ITextView));
- }
-
- private void RaiseUndoRedoHappened()
- {
- // Note: Passing null here as this is what Visual Studio does
- _undoRedoHappened?.Invoke(this, new TextUndoRedoEventArgs(_state, null));
- }
-
- bool ITextUndoHistory.CanRedo => _redoStack.Count > 0;
-
- bool ITextUndoHistory.CanUndo => _undoStack.Count > 0;
-
- ITextUndoTransaction ITextUndoHistory.CreateTransaction(string description) => CreateTransaction(description);
-
- ITextUndoTransaction ITextUndoHistory.CurrentTransaction => CurrentTransaction;
-
- ///
- /// Easy to implement but not supported by Visual Studio
- ///
- ITextUndoTransaction ITextUndoHistory.LastRedoTransaction => throw new NotSupportedException();
-
- ///
- /// Easy to implement but not supported by Visual Studio
- ///
- ITextUndoTransaction ITextUndoHistory.LastUndoTransaction => throw new NotSupportedException();
-
- void ITextUndoHistory.Redo(int count) => Redo(count);
-
- ///
- /// Easy to implement but not supported by Visual Studio
- ///
- string ITextUndoHistory.RedoDescription => throw new NotSupportedException();
-
- ///
- /// Easy to implement but not supported by Visual Studio
- ///
- IEnumerable ITextUndoHistory.RedoStack => _redoStack;
-
- TextUndoHistoryState ITextUndoHistory.State
- {
- [DebuggerNonUserCode]
- get => _state;
- }
-
- void ITextUndoHistory.Undo(int count) => Undo(count);
-
- ///
- /// Easy to implement but not supported by Visual Studio
- ///
- string ITextUndoHistory.UndoDescription => throw new NotSupportedException();
-
- event EventHandler ITextUndoHistory.UndoRedoHappened
- {
- add => _undoRedoHappened += value;
- remove => _undoRedoHappened -= value;
- }
-
- ///
- /// Easy to implement but not supported by Visual Studio
- ///
- IEnumerable ITextUndoHistory.UndoStack => _undoStack;
-
- event EventHandler ITextUndoHistory.UndoTransactionCompleted
- {
- add => _undoTransactionCompleted += value;
- remove => _undoTransactionCompleted -= value;
- }
-
- PropertyCollection IPropertyOwner.Properties => _properties;
- }
-}
diff --git a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoHistoryRegistry.cs b/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoHistoryRegistry.cs
deleted file mode 100644
index 221626e3bc9..00000000000
--- a/main/src/addins/MonoDevelop.TextEditor/MonoDevelop.TextEditor.Wpf/Undo/UndoHistoryRegistry.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-//
-// Copyright (c) Microsoft Corp. (https://www.microsoft.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using System.ComponentModel.Composition;
-using System.Runtime.CompilerServices;
-using Microsoft.VisualStudio.Text.Operations;
-
-namespace MonoDevelop.Ide.Text
-{
- ///
- /// This class is intended to be a very simple ITextUndoHistoryRegistry implementation for hosts that
- /// don't have a built-in undo mechanism
- ///
-//oe [Export(typeof(ITextUndoHistoryRegistry))] oe NOTICE prevent multiple export of this type; WHICH ONE SHOULD BE USED???
- internal sealed class TextUndoHistoryRegistry : ITextUndoHistoryRegistry
- {
- private readonly ConditionalWeakTable
-
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs
index 959db38cb8b..e80cbf2ef1d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs
@@ -23,1206 +23,1206 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using Gtk;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Gtk;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;
-using Mono.Addins;
-using MonoDevelop.Components.Commands;
-using MonoDevelop.Components.Commands.ExtensionNodes;
-using MonoDevelop.Core;
-using MonoDevelop.Core.Execution;
-using MonoDevelop.Ide;
+using Mono.Addins;
+using MonoDevelop.Components.Commands;
+using MonoDevelop.Components.Commands.ExtensionNodes;
+using MonoDevelop.Core;
+using MonoDevelop.Core.Execution;
+using MonoDevelop.Ide;
using MonoDevelop.Ide.Commands;
-using MonoDevelop.Projects;
-
-namespace MonoDevelop.Components.MainToolbar
-{
- [Serializable]
- class MainToolbarController : ICommandBar
- {
- const string ToolbarExtensionPath = "/MonoDevelop/Ide/CommandBar";
- const string TargetsMenuPath = "/MonoDevelop/Ide/TargetSelectorCommands";
-
- internal IMainToolbarView ToolbarView {
- get;
- private set;
- }
-
- internal StatusBar StatusBar {
- get { return ToolbarView.StatusBar; }
- }
-
- readonly ConfigurationProperty searchForMembers = ConfigurationProperty.Create ("MainToolbar.Search.IncludeMembers", true);
- bool SearchForMembers {
- get { return searchForMembers; }
- set { searchForMembers.Value = value; }
- }
-
- Dictionary configurationMergers = new Dictionary ();
- int ignoreConfigurationChangedCount, ignoreRuntimeChangedCount;
- Solution currentSolution;
- bool settingGlobalConfig;
- Tuple [] startupProjects = new Tuple [0];
- EventHandler executionTargetsChanged;
-
- public MainToolbarController (IMainToolbarView toolbarView)
- {
- ToolbarView = toolbarView;
- // Attach run button click handler.
- toolbarView.RunButtonClicked += HandleStartButtonClicked;
-
- // Register Search Entry handlers.
- ToolbarView.SearchEntryChanged += HandleSearchEntryChanged;
- ToolbarView.SearchEntryActivated += HandleSearchEntryActivated;
- ToolbarView.SearchEntryKeyPressed += HandleSearchEntryKeyPressed;
- ToolbarView.PerformCommand += HandleSearchEntryCommand;
- ToolbarView.SearchEntryResized += (o, e) => PositionPopup ();
- ToolbarView.SearchEntryLostFocus += (o, e) => {
- ToolbarView.SearchText = "";
- DestroyPopup ();
- };
-
- toolbarView.ConfigurationChanged += HandleConfigurationChanged;
- toolbarView.RunConfigurationChanged += HandleRunConfigurationChanged;
- toolbarView.RuntimeChanged += HandleRuntimeChanged;
-
- IdeApp.Workbench.RootWindow.WidgetEvent += delegate(object o, WidgetEventArgs args) {
- if (args.Event is Gdk.EventConfigure)
- PositionPopup ();
- };
-
- // Update Search Entry on keybinding change.
- var cmd = IdeApp.CommandService.GetCommand (Commands.NavigateTo);
- cmd.KeyBindingChanged += delegate {
- UpdateSearchEntryLabel ();
- };
-
- executionTargetsChanged = (sender, e) => UpdateCombos ();
-
- IdeApp.ProjectOperations.CurrentSelectedSolutionChanged += HandleCurrentSelectedSolutionChanged;
-
- IdeApp.Workspace.FirstWorkspaceItemRestored += (sender, e) => {
- IdeApp.Workspace.ConfigurationsChanged += HandleUpdateCombos;
- IdeApp.Workspace.ActiveConfigurationChanged += HandleUpdateCombos;
-
- IdeApp.Workspace.SolutionLoaded += HandleSolutionLoaded;
- IdeApp.Workspace.SolutionUnloaded += HandleUpdateCombos;
- IdeApp.ProjectOperations.CurrentSelectedSolutionChanged += HandleUpdateCombos;
-
- UpdateCombos ();
- };
-
- IdeApp.Workspace.LastWorkspaceItemClosed += (sender, e) => {
- IdeApp.Workspace.ConfigurationsChanged -= HandleUpdateCombos;
- IdeApp.Workspace.ActiveConfigurationChanged -= HandleUpdateCombos;
-
- IdeApp.Workspace.SolutionLoaded -= HandleSolutionLoaded;
- IdeApp.Workspace.SolutionUnloaded -= HandleUpdateCombos;
-
- IdeApp.ProjectOperations.CurrentSelectedSolutionChanged -= HandleUpdateCombos;
-
- StatusBar.ShowReady ();
- };
-
- AddinManager.ExtensionChanged += OnExtensionChanged;
- }
-
- public void Initialize ()
- {
- var items = new[] {
- new SearchMenuModel (GettextCatalog.GetString ("Search Files"), "file"),
- new SearchMenuModel (GettextCatalog.GetString ("Search Types"), "type"),
- new SearchMenuModel (GettextCatalog.GetString ("Search Members"), "member"),
- new SearchMenuModel (GettextCatalog.GetString ("Search Commands"), "command"),
- };
-
- // Attach menu category handlers.
- foreach (var item in items)
- item.Activated += (o, e) => SetSearchCategory (item.Category);
- ToolbarView.SearchMenuItems = items;
-
- // Update Search Entry label initially.
- UpdateSearchEntryLabel ();
-
- // Rebuild the button bars.
- RebuildToolbar ();
-
- UpdateCombos ();
-
- // Register this controller as a commandbar.
- IdeApp.CommandService.RegisterCommandBar (this);
- }
-
- void UpdateCombos ()
- {
- if (settingGlobalConfig)
- return;
-
- ignoreConfigurationChangedCount++;
- try {
- if (!IdeApp.Workspace.IsOpen) {
- configurationMergers.Clear ();
- ToolbarView.ConfigurationModel = Enumerable.Empty ();
- ToolbarView.RuntimeModel = Enumerable.Empty ();
- ToolbarView.RunConfigurationModel = Enumerable.Empty ();
- ToolbarView.RunConfigurationVisible = false;
- return;
- }
- if (currentSolution != null)
- ToolbarView.RunConfigurationModel = currentSolution.GetRunConfigurations ().Select (rc => new RunConfigurationModel (rc)).ToArray ();
- else
- ToolbarView.RunConfigurationModel = Enumerable.Empty ();
- SelectActiveRunConfiguration ();
- TrackStartupProject ();
- configurationMergers = new Dictionary ();
- foreach (var project in startupProjects) {
- var configurationMerger = new ConfigurationMerger ();
- configurationMerger.Load (currentSolution, project.Item1, project.Item2);
- configurationMergers [project.Item1] = configurationMerger;
- }
- if (configurationMergers.Count == 1)
- ToolbarView.ConfigurationModel = configurationMergers.First ().Value.SolutionConfigurations
- .Distinct ()
- .Select (conf => new ConfigurationModel (conf));
- else
- ToolbarView.ConfigurationModel = currentSolution?.Configurations.OfType ()
- .Select (conf => new ConfigurationModel (conf.Id)) ?? new ConfigurationModel [0];
-
- } finally {
- ignoreConfigurationChangedCount--;
- }
-
- ToolbarView.RunConfigurationVisible = ToolbarView.RunConfigurationModel.Count () > 1;
-
- FillRuntimes ();
- SelectActiveConfiguration ();
- }
-
- void FillRuntimes ()
- {
- ignoreRuntimeChangedCount++;
- try {
- ToolbarView.RuntimeModel = Enumerable.Empty ();
- if (!IdeApp.Workspace.IsOpen || currentSolution == null)
- return;
- var list = new List ();
- int runtimes = 0;
- if (currentSolution.StartupConfiguration is MultiItemSolutionRunConfiguration) {
- bool anyValid = false;
- foreach (var startConf in ((MultiItemSolutionRunConfiguration)currentSolution.StartupConfiguration).Items) {
- if (startConf?.SolutionItem == null)
- continue;
-
- // Check that the current startup project is enabled for the current configuration
- var solConf = currentSolution.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
- if (solConf == null || !solConf.BuildEnabledForItem (startConf.SolutionItem))
- continue;
- anyValid = true;
- var projectList = new List ();
- FillRuntimesForProject (projectList, startConf.SolutionItem, ref runtimes);
- var parent = new RuntimeModel (this, startConf.SolutionItem.Name);
- parent.HasChildren = true;
- list.Add (parent);
- foreach (var p in projectList) {
- parent.AddChild (p);
- }
- }
- if (!anyValid)
- return;
- } else {
- var startConf = currentSolution.StartupConfiguration as SingleItemSolutionRunConfiguration;
- if (startConf == null || startConf.Item == null)
- return;
-
- // Check that the current startup project is enabled for the current configuration
- var solConf = currentSolution.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
- if (solConf == null || !solConf.BuildEnabledForItem (startConf.Item))
- return;
- FillRuntimesForProject (list, startConf.Item, ref runtimes);
- }
-
-
- var cmds = IdeApp.CommandService.CreateCommandEntrySet (TargetsMenuPath);
- if (cmds.Count > 0) {
- bool needsSeparator = runtimes > 0;
+using MonoDevelop.Projects;
+
+namespace MonoDevelop.Components.MainToolbar
+{
+ [Serializable]
+ class MainToolbarController : ICommandBar
+ {
+ const string ToolbarExtensionPath = "/MonoDevelop/Ide/CommandBar";
+ const string TargetsMenuPath = "/MonoDevelop/Ide/TargetSelectorCommands";
+
+ internal IMainToolbarView ToolbarView {
+ get;
+ private set;
+ }
+
+ internal StatusBar StatusBar {
+ get { return ToolbarView.StatusBar; }
+ }
+
+ readonly ConfigurationProperty searchForMembers = ConfigurationProperty.Create ("MainToolbar.Search.IncludeMembers", true);
+ bool SearchForMembers {
+ get { return searchForMembers; }
+ set { searchForMembers.Value = value; }
+ }
+
+ Dictionary configurationMergers = new Dictionary ();
+ int ignoreConfigurationChangedCount, ignoreRuntimeChangedCount;
+ Solution currentSolution;
+ bool settingGlobalConfig;
+ Tuple [] startupProjects = new Tuple [0];
+ EventHandler executionTargetsChanged;
+
+ public MainToolbarController (IMainToolbarView toolbarView)
+ {
+ ToolbarView = toolbarView;
+ // Attach run button click handler.
+ toolbarView.RunButtonClicked += HandleStartButtonClicked;
+
+ // Register Search Entry handlers.
+ ToolbarView.SearchEntryChanged += HandleSearchEntryChanged;
+ ToolbarView.SearchEntryActivated += HandleSearchEntryActivated;
+ ToolbarView.SearchEntryKeyPressed += HandleSearchEntryKeyPressed;
+ ToolbarView.PerformCommand += HandleSearchEntryCommand;
+ ToolbarView.SearchEntryResized += (o, e) => PositionPopup ();
+ ToolbarView.SearchEntryLostFocus += (o, e) => {
+ ToolbarView.SearchText = "";
+ DestroyPopup ();
+ };
+
+ toolbarView.ConfigurationChanged += HandleConfigurationChanged;
+ toolbarView.RunConfigurationChanged += HandleRunConfigurationChanged;
+ toolbarView.RuntimeChanged += HandleRuntimeChanged;
+
+ IdeApp.Workbench.RootWindow.WidgetEvent += delegate(object o, WidgetEventArgs args) {
+ if (args.Event is Gdk.EventConfigure)
+ PositionPopup ();
+ };
+
+ // Update Search Entry on keybinding change.
+ var cmd = IdeApp.CommandService.GetCommand (Commands.NavigateTo);
+ cmd.KeyBindingChanged += delegate {
+ UpdateSearchEntryLabel ();
+ };
+
+ executionTargetsChanged = (sender, e) => UpdateCombos ();
+
+ IdeApp.ProjectOperations.CurrentSelectedSolutionChanged += HandleCurrentSelectedSolutionChanged;
+
+ IdeApp.Workspace.FirstWorkspaceItemRestored += (sender, e) => {
+ IdeApp.Workspace.ConfigurationsChanged += HandleUpdateCombos;
+ IdeApp.Workspace.ActiveConfigurationChanged += HandleUpdateCombos;
+
+ IdeApp.Workspace.SolutionLoaded += HandleSolutionLoaded;
+ IdeApp.Workspace.SolutionUnloaded += HandleUpdateCombos;
+ IdeApp.ProjectOperations.CurrentSelectedSolutionChanged += HandleUpdateCombos;
+
+ UpdateCombos ();
+ };
+
+ IdeApp.Workspace.LastWorkspaceItemClosed += (sender, e) => {
+ IdeApp.Workspace.ConfigurationsChanged -= HandleUpdateCombos;
+ IdeApp.Workspace.ActiveConfigurationChanged -= HandleUpdateCombos;
+
+ IdeApp.Workspace.SolutionLoaded -= HandleSolutionLoaded;
+ IdeApp.Workspace.SolutionUnloaded -= HandleUpdateCombos;
+
+ IdeApp.ProjectOperations.CurrentSelectedSolutionChanged -= HandleUpdateCombos;
+
+ StatusBar.ShowReady ();
+ };
+
+ AddinManager.ExtensionChanged += OnExtensionChanged;
+ }
+
+ public void Initialize ()
+ {
+ var items = new[] {
+ new SearchMenuModel (GettextCatalog.GetString ("Search Files"), "file"),
+ new SearchMenuModel (GettextCatalog.GetString ("Search Types"), "type"),
+ new SearchMenuModel (GettextCatalog.GetString ("Search Members"), "member"),
+ new SearchMenuModel (GettextCatalog.GetString ("Search Commands"), "command"),
+ };
+
+ // Attach menu category handlers.
+ foreach (var item in items)
+ item.Activated += (o, e) => SetSearchCategory (item.Category);
+ ToolbarView.SearchMenuItems = items;
+
+ // Update Search Entry label initially.
+ UpdateSearchEntryLabel ();
+
+ // Rebuild the button bars.
+ RebuildToolbar ();
+
+ UpdateCombos ();
+
+ // Register this controller as a commandbar.
+ IdeApp.CommandService.RegisterCommandBar (this);
+ }
+
+ void UpdateCombos ()
+ {
+ if (settingGlobalConfig)
+ return;
+
+ ignoreConfigurationChangedCount++;
+ try {
+ if (!IdeApp.Workspace.IsOpen) {
+ configurationMergers.Clear ();
+ ToolbarView.ConfigurationModel = Enumerable.Empty ();
+ ToolbarView.RuntimeModel = Enumerable.Empty ();
+ ToolbarView.RunConfigurationModel = Enumerable.Empty ();
+ ToolbarView.RunConfigurationVisible = false;
+ return;
+ }
+ if (currentSolution != null)
+ ToolbarView.RunConfigurationModel = currentSolution.GetRunConfigurations ().Select (rc => new RunConfigurationModel (rc)).ToArray ();
+ else
+ ToolbarView.RunConfigurationModel = Enumerable.Empty ();
+ SelectActiveRunConfiguration ();
+ TrackStartupProject ();
+ configurationMergers = new Dictionary ();
+ foreach (var project in startupProjects) {
+ var configurationMerger = new ConfigurationMerger ();
+ configurationMerger.Load (currentSolution, project.Item1, project.Item2);
+ configurationMergers [project.Item1] = configurationMerger;
+ }
+ if (configurationMergers.Count == 1)
+ ToolbarView.ConfigurationModel = configurationMergers.First ().Value.SolutionConfigurations
+ .Distinct ()
+ .Select (conf => new ConfigurationModel (conf));
+ else
+ ToolbarView.ConfigurationModel = currentSolution?.Configurations.OfType ()
+ .Select (conf => new ConfigurationModel (conf.Id)) ?? new ConfigurationModel [0];
+
+ } finally {
+ ignoreConfigurationChangedCount--;
+ }
+
+ ToolbarView.RunConfigurationVisible = ToolbarView.RunConfigurationModel.Count () > 1;
+
+ FillRuntimes ();
+ SelectActiveConfiguration ();
+ }
+
+ void FillRuntimes ()
+ {
+ ignoreRuntimeChangedCount++;
+ try {
+ ToolbarView.RuntimeModel = Enumerable.Empty ();
+ if (!IdeApp.Workspace.IsOpen || currentSolution == null)
+ return;
+ var list = new List ();
+ int runtimes = 0;
+ if (currentSolution.StartupConfiguration is MultiItemSolutionRunConfiguration) {
+ bool anyValid = false;
+ foreach (var startConf in ((MultiItemSolutionRunConfiguration)currentSolution.StartupConfiguration).Items) {
+ if (startConf?.SolutionItem == null)
+ continue;
+
+ // Check that the current startup project is enabled for the current configuration
+ var solConf = currentSolution.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
+ if (solConf == null || !solConf.BuildEnabledForItem (startConf.SolutionItem))
+ continue;
+ anyValid = true;
+ var projectList = new List ();
+ FillRuntimesForProject (projectList, startConf.SolutionItem, ref runtimes);
+ var parent = new RuntimeModel (this, startConf.SolutionItem.Name);
+ parent.HasChildren = true;
+ list.Add (parent);
+ foreach (var p in projectList) {
+ parent.AddChild (p);
+ }
+ }
+ if (!anyValid)
+ return;
+ } else {
+ var startConf = currentSolution.StartupConfiguration as SingleItemSolutionRunConfiguration;
+ if (startConf == null || startConf.Item == null)
+ return;
+
+ // Check that the current startup project is enabled for the current configuration
+ var solConf = currentSolution.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
+ if (solConf == null || !solConf.BuildEnabledForItem (startConf.Item))
+ return;
+ FillRuntimesForProject (list, startConf.Item, ref runtimes);
+ }
+
+
+ var cmds = IdeApp.CommandService.CreateCommandEntrySet (TargetsMenuPath);
+ if (cmds.Count > 0) {
+ bool needsSeparator = runtimes > 0;
var an = DockNotebook.DockNotebook.ActiveNotebook;
- foreach (CommandEntry ce in cmds) {
- if (ce.CommandId == Command.Separator) {
- needsSeparator = true;
- continue;
- }
- var cmd = ce.GetCommand (IdeApp.CommandService) as ActionCommand;
- if (cmd != null) {
+ foreach (CommandEntry ce in cmds) {
+ if (ce.CommandId == Command.Separator) {
+ needsSeparator = true;
+ continue;
+ }
+ var cmd = ce.GetCommand (IdeApp.CommandService) as ActionCommand;
+ if (cmd != null) {
var ci = IdeApp.CommandService.GetCommandInfo (cmd.Id, new CommandTargetRoute (lastCommandTarget));
- if (ci.Visible) {
- if (needsSeparator) {
- list.Add (new RuntimeModel (this, displayText: null));
- needsSeparator = false;
- }
- list.Add (new RuntimeModel (this, cmd));
- runtimes++;
- }
- }
+ if (ci.Visible) {
+ if (needsSeparator) {
+ list.Add (new RuntimeModel (this, displayText: null));
+ needsSeparator = false;
+ }
+ list.Add (new RuntimeModel (this, cmd));
+ runtimes++;
+ }
+ }
+ }
+ DockNotebook.DockNotebook.ActiveNotebook = an;
+ }
+
+ ToolbarView.PlatformSensitivity = runtimes > 1;
+ ToolbarView.RuntimeModel = list;
+ } finally {
+ ignoreRuntimeChangedCount--;
+ }
+ }
+
+ void FillRuntimesForProject (List list, SolutionItem project, ref int runtimes)
+ {
+ ExecutionTarget previous = null;
+
+ foreach (var target in configurationMergers [project].GetTargetsForConfiguration (IdeApp.Workspace.ActiveConfigurationId, configurationMergers.Count < 2)) {
+ if (target is ExecutionTargetGroup) {
+ var devices = (ExecutionTargetGroup)target;
+
+ if (previous != null)
+ list.Add (new RuntimeModel (this, displayText: null));//Seperator
+
+ list.Add (new RuntimeModel (this, target, true, project));
+ foreach (var device in devices) {
+ if (device is ExecutionTargetGroup) {
+ var versions = (ExecutionTargetGroup)device;
+
+ if (versions.Count > 1) {
+ var parent = new RuntimeModel (this, device, true, project) {
+ IsIndented = true,
+ };
+ list.Add (parent);
+
+ foreach (var version in versions) {
+ parent.AddChild (new RuntimeModel (this, version, false, project));
+ runtimes++;
+ }
+ } else {
+ list.Add (new RuntimeModel (this, versions [0], true, project) {
+ IsIndented = true,
+ });
+ runtimes++;
+ }
+ } else {
+ list.Add (new RuntimeModel (this, device, true, project) {
+ IsIndented = true,
+ });
+ runtimes++;
+ }
}
- DockNotebook.DockNotebook.ActiveNotebook = an;
- }
-
- ToolbarView.PlatformSensitivity = runtimes > 1;
- ToolbarView.RuntimeModel = list;
- } finally {
- ignoreRuntimeChangedCount--;
- }
- }
-
- void FillRuntimesForProject (List list, SolutionItem project, ref int runtimes)
- {
- ExecutionTarget previous = null;
-
- foreach (var target in configurationMergers [project].GetTargetsForConfiguration (IdeApp.Workspace.ActiveConfigurationId, configurationMergers.Count < 2)) {
- if (target is ExecutionTargetGroup) {
- var devices = (ExecutionTargetGroup)target;
-
- if (previous != null)
- list.Add (new RuntimeModel (this, displayText: null));//Seperator
-
- list.Add (new RuntimeModel (this, target, true, project));
- foreach (var device in devices) {
- if (device is ExecutionTargetGroup) {
- var versions = (ExecutionTargetGroup)device;
-
- if (versions.Count > 1) {
- var parent = new RuntimeModel (this, device, true, project) {
- IsIndented = true,
- };
- list.Add (parent);
-
- foreach (var version in versions) {
- parent.AddChild (new RuntimeModel (this, version, false, project));
- runtimes++;
- }
- } else {
- list.Add (new RuntimeModel (this, versions [0], true, project) {
- IsIndented = true,
- });
- runtimes++;
- }
- } else {
- list.Add (new RuntimeModel (this, device, true, project) {
- IsIndented = true,
- });
- runtimes++;
- }
- }
- } else {
- if (previous is ExecutionTargetGroup) {
- list.Add (new RuntimeModel (this, displayText: null));//Seperator
- }
-
- list.Add (new RuntimeModel (this, target, true, project));
- runtimes++;
- }
-
- previous = target;
- }
- }
-
- void HandleRuntimeChanged (object sender, HandledEventArgs e)
- {
- if (ignoreRuntimeChangedCount == 0) {
- var runtime = (RuntimeModel)ToolbarView.ActiveRuntime;
- if (runtime != null && runtime.Command != null) {
- e.Handled = runtime.NotifyActivated ();
- return;
- }
-
- NotifyConfigurationChange ();
- SelectActiveRuntime (runtime);
- }
- }
-
- void HandleConfigurationChanged (object sender, EventArgs e)
- {
- if (ignoreConfigurationChangedCount == 0)
- NotifyConfigurationChange ();
- }
-
- void HandleRunConfigurationChanged (object sender, EventArgs e)
- {
- if (ignoreConfigurationChangedCount == 0)
- NotifyRunConfigurationChange ();
- }
-
- void UpdateBuildConfiguration ()
- {
- var config = ToolbarView.ActiveConfiguration;
- if (config == null)
- return;
- if (configurationMergers.Count > 1 || configurationMergers.Count == 0) {
- settingGlobalConfig = true;
- try {
- IdeApp.Workspace.ActiveConfigurationId = config.OriginalId;
- } finally {
- settingGlobalConfig = false;
- }
- return;
- }
-
- ExecutionTarget newTarget;
- string fullConfig;
-
- var runtime = (RuntimeModel)ToolbarView.ActiveRuntime;
- configurationMergers.Values.First ().ResolveConfiguration (config.OriginalId, runtime != null ? runtime.ExecutionTarget : null, out fullConfig, out newTarget);
- settingGlobalConfig = true;
- try {
- IdeApp.Workspace.ActiveExecutionTarget = newTarget;
- IdeApp.Workspace.ActiveConfigurationId = fullConfig;
- } finally {
- settingGlobalConfig = false;
- }
- }
-
- void NotifyConfigurationChange ()
- {
- if (ToolbarView.ActiveConfiguration == null)
- return;
-
- UpdateBuildConfiguration ();
-
- FillRuntimes ();
- SelectActiveRuntime (ToolbarView.ActiveRuntime as RuntimeModel);
- }
-
- void NotifyRunConfigurationChange ()
- {
- if (ToolbarView.ActiveRunConfiguration == null)
- return;
-
- var model = (RunConfigurationModel)ToolbarView.ActiveRunConfiguration;
- currentSolution.StartupConfiguration = model.RunConfiguration;
- }
-
- void SelectActiveRunConfiguration ()
- {
- var sconf = currentSolution?.StartupConfiguration;
- var confs = ToolbarView.RunConfigurationModel.Cast ().ToList ();
- if (confs.Count > 0) {
- bool selected = false;
-
- foreach (var item in confs) {
- if (item.RunConfiguration.Id == sconf?.Id) {
- ToolbarView.ActiveRunConfiguration = item;
- selected = true;
- break;
- }
- }
-
- if (!selected) {
- var defaultConfig = confs.First ();
- ToolbarView.ActiveRunConfiguration = defaultConfig;
- if (currentSolution != null)
- currentSolution.StartupConfiguration = defaultConfig.RunConfiguration;
- }
- }
- }
-
- void SelectActiveConfiguration ()
- {
- var allNames = configurationMergers.Values.Select (cm => cm.GetUnresolvedConfiguration (IdeApp.Workspace.ActiveConfigurationId)).Distinct ();
- string name;
- if (allNames.Count () == 1)
- name = allNames.First ();
- else
- name = IdeApp.Workspace.ActiveConfigurationId;
-
- ignoreConfigurationChangedCount++;
- try {
- var confs = ToolbarView.ConfigurationModel.ToList ();
- if (confs.Count > 0) {
- string defaultConfig = ToolbarView.ActiveConfiguration != null ? ToolbarView.ActiveConfiguration.OriginalId : confs[0].OriginalId;
- bool selected = false;
-
- foreach (var item in confs) {
- string config = item.OriginalId;
- if (config == name) {
- ToolbarView.ActiveConfiguration = item;
- UpdateBuildConfiguration ();
- selected = true;
- break;
- }
- }
-
- if (!selected) {
- ToolbarView.ActiveConfiguration = ToolbarView.ConfigurationModel.First ();
- UpdateBuildConfiguration ();
- }
- }
- } finally {
- ignoreConfigurationChangedCount--;
- }
-
- SelectActiveRuntime (ToolbarView.ActiveRuntime as RuntimeModel);
- }
-
- IEnumerable AllRuntimes (IEnumerable runtimes)
- {
- foreach (var runtime in runtimes) {
- yield return runtime;
- foreach (var childRuntime in AllRuntimes (runtime.Children))
- yield return childRuntime;
- }
- }
-
- RuntimeModel SelectActiveRuntime (SolutionItem project, RuntimeModel preferedRuntimeModel)
- {
- var runtimes = AllRuntimes (ToolbarView.RuntimeModel).Cast ().ToList ();
+ } else {
+ if (previous is ExecutionTargetGroup) {
+ list.Add (new RuntimeModel (this, displayText: null));//Seperator
+ }
+
+ list.Add (new RuntimeModel (this, target, true, project));
+ runtimes++;
+ }
+
+ previous = target;
+ }
+ }
+
+ void HandleRuntimeChanged (object sender, HandledEventArgs e)
+ {
+ if (ignoreRuntimeChangedCount == 0) {
+ var runtime = (RuntimeModel)ToolbarView.ActiveRuntime;
+ if (runtime != null && runtime.Command != null) {
+ e.Handled = runtime.NotifyActivated ();
+ return;
+ }
+
+ NotifyConfigurationChange ();
+ SelectActiveRuntime (runtime);
+ }
+ }
+
+ void HandleConfigurationChanged (object sender, EventArgs e)
+ {
+ if (ignoreConfigurationChangedCount == 0)
+ NotifyConfigurationChange ();
+ }
+
+ void HandleRunConfigurationChanged (object sender, EventArgs e)
+ {
+ if (ignoreConfigurationChangedCount == 0)
+ NotifyRunConfigurationChange ();
+ }
+
+ void UpdateBuildConfiguration ()
+ {
+ var config = ToolbarView.ActiveConfiguration;
+ if (config == null)
+ return;
+ if (configurationMergers.Count > 1 || configurationMergers.Count == 0) {
+ settingGlobalConfig = true;
+ try {
+ IdeApp.Workspace.ActiveConfigurationId = config.OriginalId;
+ } finally {
+ settingGlobalConfig = false;
+ }
+ return;
+ }
+
+ ExecutionTarget newTarget;
+ string fullConfig;
+
+ var runtime = (RuntimeModel)ToolbarView.ActiveRuntime;
+ configurationMergers.Values.First ().ResolveConfiguration (config.OriginalId, runtime != null ? runtime.ExecutionTarget : null, out fullConfig, out newTarget);
+ settingGlobalConfig = true;
+ try {
+ IdeApp.Workspace.ActiveExecutionTarget = newTarget;
+ IdeApp.Workspace.ActiveConfigurationId = fullConfig;
+ } finally {
+ settingGlobalConfig = false;
+ }
+ }
+
+ void NotifyConfigurationChange ()
+ {
+ if (ToolbarView.ActiveConfiguration == null)
+ return;
+
+ UpdateBuildConfiguration ();
+
+ FillRuntimes ();
+ SelectActiveRuntime (ToolbarView.ActiveRuntime as RuntimeModel);
+ }
+
+ void NotifyRunConfigurationChange ()
+ {
+ if (ToolbarView.ActiveRunConfiguration == null)
+ return;
+
+ var model = (RunConfigurationModel)ToolbarView.ActiveRunConfiguration;
+ currentSolution.StartupConfiguration = model.RunConfiguration;
+ }
+
+ void SelectActiveRunConfiguration ()
+ {
+ var sconf = currentSolution?.StartupConfiguration;
+ var confs = ToolbarView.RunConfigurationModel.Cast ().ToList ();
+ if (confs.Count > 0) {
+ bool selected = false;
+
+ foreach (var item in confs) {
+ if (item.RunConfiguration.Id == sconf?.Id) {
+ ToolbarView.ActiveRunConfiguration = item;
+ selected = true;
+ break;
+ }
+ }
+
+ if (!selected) {
+ var defaultConfig = confs.First ();
+ ToolbarView.ActiveRunConfiguration = defaultConfig;
+ if (currentSolution != null)
+ currentSolution.StartupConfiguration = defaultConfig.RunConfiguration;
+ }
+ }
+ }
+
+ void SelectActiveConfiguration ()
+ {
+ var allNames = configurationMergers.Values.Select (cm => cm.GetUnresolvedConfiguration (IdeApp.Workspace.ActiveConfigurationId)).Distinct ();
+ string name;
+ if (allNames.Count () == 1)
+ name = allNames.First ();
+ else
+ name = IdeApp.Workspace.ActiveConfigurationId;
+
+ ignoreConfigurationChangedCount++;
+ try {
+ var confs = ToolbarView.ConfigurationModel.ToList ();
+ if (confs.Count > 0) {
+ string defaultConfig = ToolbarView.ActiveConfiguration != null ? ToolbarView.ActiveConfiguration.OriginalId : confs[0].OriginalId;
+ bool selected = false;
+
+ foreach (var item in confs) {
+ string config = item.OriginalId;
+ if (config == name) {
+ ToolbarView.ActiveConfiguration = item;
+ UpdateBuildConfiguration ();
+ selected = true;
+ break;
+ }
+ }
+
+ if (!selected) {
+ ToolbarView.ActiveConfiguration = ToolbarView.ConfigurationModel.First ();
+ UpdateBuildConfiguration ();
+ }
+ }
+ } finally {
+ ignoreConfigurationChangedCount--;
+ }
+
+ SelectActiveRuntime (ToolbarView.ActiveRuntime as RuntimeModel);
+ }
+
+ IEnumerable AllRuntimes (IEnumerable runtimes)
+ {
+ foreach (var runtime in runtimes) {
+ yield return runtime;
+ foreach (var childRuntime in AllRuntimes (runtime.Children))
+ yield return childRuntime;
+ }
+ }
+
+ RuntimeModel SelectActiveRuntime (SolutionItem project, RuntimeModel preferedRuntimeModel)
+ {
+ var runtimes = AllRuntimes (ToolbarView.RuntimeModel).Cast ().ToList ();
string lastRuntimeForProject = project.UserProperties.GetValue ("PreferredExecutionTarget", defaultValue: null);
- var activeTarget = preferedRuntimeModel?.Project == project ? preferedRuntimeModel.ExecutionTarget : null;
- var multiProjectExecutionTarget = activeTarget as MultiProjectExecutionTarget;
- if (multiProjectExecutionTarget != null) {
- activeTarget = multiProjectExecutionTarget.GetTarget (project);
- }
- var activeTargetId = activeTarget?.Id;
- RuntimeModel defaultRuntime = null;
-
- foreach (var item in runtimes) {
- using (var model = item.GetMutableModel ()) {
- if (!model.Enabled)
- continue;
- }
-
- var target = item.ExecutionTarget;
- if (target == null || item.Project != project)
- continue;
-
- if (target is ExecutionTargetGroup)
- if (item.HasChildren)
- continue;
-
- if (defaultRuntime == null || lastRuntimeForProject == target.Id) {
- defaultRuntime = item;
- }
-
- if (target.Id == activeTargetId) {
- project.UserProperties.SetValue ("PreferredExecutionTarget", target.Id);
- return item;
- }
-
- if (target.Equals (activeTarget)) {
- defaultRuntime = item;
- }
- }
+ var activeTarget = preferedRuntimeModel?.Project == project ? preferedRuntimeModel.ExecutionTarget : null;
+ var multiProjectExecutionTarget = activeTarget as MultiProjectExecutionTarget;
+ if (multiProjectExecutionTarget != null) {
+ activeTarget = multiProjectExecutionTarget.GetTarget (project);
+ }
+ var activeTargetId = activeTarget?.Id;
+ RuntimeModel defaultRuntime = null;
+
+ foreach (var item in runtimes) {
+ using (var model = item.GetMutableModel ()) {
+ if (!model.Enabled)
+ continue;
+ }
+
+ var target = item.ExecutionTarget;
+ if (target == null || item.Project != project)
+ continue;
+
+ if (target is ExecutionTargetGroup)
+ if (item.HasChildren)
+ continue;
+
+ if (defaultRuntime == null || lastRuntimeForProject == target.Id) {
+ defaultRuntime = item;
+ }
+
+ if (target.Id == activeTargetId) {
+ project.UserProperties.SetValue ("PreferredExecutionTarget", target.Id);
+ return item;
+ }
+
+ if (target.Equals (activeTarget)) {
+ defaultRuntime = item;
+ }
+ }
if (defaultRuntime?.ExecutionTarget?.Id != null)
- project.UserProperties.SetValue("PreferredExecutionTarget", defaultRuntime.ExecutionTarget.Id);
- return defaultRuntime;
- }
-
- void SelectActiveRuntime (RuntimeModel preferedRuntimeModel)
- {
- ignoreRuntimeChangedCount++;
-
- try {
- if (ToolbarView.RuntimeModel.Any ()) {
- if (startupProjects.Length > 1) {
- var multiProjectTarget = new MultiProjectExecutionTarget ();
- var multipleRuntime = new RuntimeModel (this, multiProjectTarget, false, null);
- foreach (var startupProject in startupProjects) {
- var runtimeModel = SelectActiveRuntime (startupProject.Item1, preferedRuntimeModel);
- if (runtimeModel == null) {
- LoggingService.LogError ($"No runtimeModel for {startupProject.Item1.Name}");
- continue;
- }
- multiProjectTarget.SetExecutionTarget (startupProject.Item1, runtimeModel.ExecutionTarget);
- multipleRuntime.AddChild (runtimeModel);
- }
- ToolbarView.ActiveRuntime = multipleRuntime;
- IdeApp.Workspace.ActiveExecutionTarget = multipleRuntime.ExecutionTarget;
- } else if (startupProjects.Length == 1) {
- var runtimeModel = SelectActiveRuntime (startupProjects.First ().Item1, preferedRuntimeModel);
- ToolbarView.ActiveRuntime = runtimeModel;
- IdeApp.Workspace.ActiveExecutionTarget = runtimeModel?.ExecutionTarget;
- UpdateBuildConfiguration ();
- } else {
- ToolbarView.ActiveRuntime = null;
- IdeApp.Workspace.ActiveExecutionTarget = null;
- }
- }
- } finally {
- ignoreRuntimeChangedCount--;
- }
- }
-
- void HandleSolutionLoaded (object sender, EventArgs e)
- {
- if (currentSolution != null)
- return;
-
- UpdateCombos ();
- }
-
- void HandleUpdateCombos (object sender, EventArgs e)
- {
-
- UpdateCombos ();
- }
-
- void HandleCurrentSelectedSolutionChanged (object sender, SolutionEventArgs e)
- {
- if (currentSolution != null) {
- currentSolution.StartupConfigurationChanged -= HandleStartupItemChanged;
- currentSolution.Saved -= HandleSolutionSaved;
- currentSolution.EntrySaved -= HandleSolutionEntrySaved;
- currentSolution.SolutionItemAdded -= HandleSolutionItemAdded;
- }
-
- currentSolution = e.Solution;
-
- if (currentSolution != null) {
- currentSolution.StartupConfigurationChanged += HandleStartupItemChanged;
- currentSolution.Saved += HandleSolutionSaved;
- currentSolution.EntrySaved += HandleSolutionEntrySaved;
- currentSolution.SolutionItemAdded += HandleSolutionItemAdded;
- }
-
- TrackStartupProject ();
- }
-
- void TrackStartupProject ()
- {
- Tuple [] projects;
- if (currentSolution?.StartupConfiguration is MultiItemSolutionRunConfiguration) {
- var multiRunConfigs = (MultiItemSolutionRunConfiguration)currentSolution.StartupConfiguration;
- projects = multiRunConfigs.Items.Select (rc => new Tuple (
- rc.SolutionItem,
- rc.RunConfiguration
- )).ToArray ();
- } else if (currentSolution?.StartupConfiguration is SingleItemSolutionRunConfiguration) {
- var singleRunConfig = (SingleItemSolutionRunConfiguration)currentSolution.StartupConfiguration;
- projects = new Tuple []{ new Tuple (
- singleRunConfig.Item, singleRunConfig.RunConfiguration)};
- } else {
- projects = new Tuple [0];
- }
- if (!startupProjects.SequenceEqual (projects)) {
- foreach (var item in startupProjects)
- item.Item1.ExecutionTargetsChanged -= executionTargetsChanged;
- foreach (var item in projects)
- item.Item1.ExecutionTargetsChanged += executionTargetsChanged;
- startupProjects = projects;
- }
- }
-
- void HandleSolutionSaved (object sender, EventArgs e)
- {
- UpdateCombos ();
- }
-
- void HandleSolutionEntrySaved (object sender, SolutionItemSavedEventArgs e)
- {
- // Skip the per-project update when a solution is being saved. The solution Saved callback will do the final update.
- if (!e.SavingSolution)
- HandleSolutionSaved (sender, e);
- }
-
- void HandleSolutionItemAdded (object sender, SolutionItemChangeEventArgs e)
- {
- // When a solution item is added due to a reload we need to ensure the configurationMergers dictionary is
- // using the new project and not the old disposed project.
- if (e.Reloading)
- UpdateCombos ();
- }
-
- void HandleStartupItemChanged (object sender, EventArgs e)
- {
- TrackStartupProject ();
- if (ignoreConfigurationChangedCount == 0)
- UpdateCombos ();
- }
-
- void OnExtensionChanged (object sender, ExtensionEventArgs args)
- {
- if (args.PathChanged (ToolbarExtensionPath))
- RebuildToolbar ();
- }
-
- void UpdateSearchEntryLabel ()
- {
- var info = IdeApp.CommandService.GetCommand (Commands.NavigateTo);
- ToolbarView.SearchPlaceholderMessage = !string.IsNullOrEmpty (info.AccelKey) ?
- GettextCatalog.GetString ("Press \u2018{0}\u2019 to search", KeyBindingManager.BindingToDisplayLabel (info.AccelKey, false)) :
- GettextCatalog.GetString ("Search solution");
- }
-
- SearchPopupWindow popup = null;
- static readonly SearchPopupSearchPattern emptyColonPattern = SearchPopupSearchPattern.ParsePattern (":");
- void PositionPopup ()
- {
- if (popup == null)
- return;
-
- popup.IgnoreRepositionWindow = false;
-
- var anchor = ToolbarView.PopupAnchor;
- if (IdeApp.Workbench.RootWindow.Visible)
- popup.ShowPopup (anchor, PopupPosition.TopRight);
-
- if (anchor.GdkWindow == null) {
- var location = new Xwt.Point (anchor.Allocation.X + anchor.Allocation.Width - popup.Size.Width, anchor.Allocation.Y);
-
- // Need to hard lock the location because Xwt doesn't know that the allocation might be coming from a
- // Cocoa control and thus has been changed to take macOS monitor layout into consideration
- popup.IgnoreRepositionWindow = true;
- popup.Location = location;
- }
- }
-
- void DestroyPopup ()
- {
- if (popup != null) {
- popup.Close ();
- popup.Destroy ();
- popup = null;
- }
- }
-
- void HandleSearchEntryChanged (object sender, EventArgs e)
- {
- if (!string.IsNullOrEmpty (ToolbarView.SearchText))
- lastSearchText = ToolbarView.SearchText;
-
- if (string.IsNullOrEmpty (ToolbarView.SearchText)){
- DestroyPopup ();
- return;
- }
- var pattern = SearchPopupSearchPattern.ParsePattern (ToolbarView.SearchText);
- if (pattern.Pattern == null && pattern.LineNumber > 0 || pattern == emptyColonPattern) {
- if (popup != null) {
- popup.Hide ();
- }
- return;
- } else {
- if (popup != null && !popup.Visible)
- popup.Show ();
- }
-
- if (popup == null) {
- popup = new SearchPopupWindow ();
- popup.SearchForMembers = SearchForMembers;
- popup.Disposed += delegate {
- popup = null;
- ToolbarView.SearchText = "";
- };
- popup.SelectedItemChanged += delegate {
- var si = popup?.Content?.SelectedItem;
- if (si == null || !si.IsValid)
- return;
- var text = si.DataSource [si.Item].AccessibilityMessage;
- if (string.IsNullOrEmpty (text))
- return;
-
- ToolbarView.ShowAccessibilityAnnouncement (text);
- };
- PositionPopup ();
- popup.Show ();
- }
- // popup.Update () is thread safe, so run it on a bg thread for faster results
- Task.Run (() => popup.Update (pattern)).Ignore ();
- }
-
- void HandleSearchEntryActivated (object sender, EventArgs e)
- {
- var pattern = SearchPopupSearchPattern.ParsePattern (ToolbarView.SearchText);
- if (pattern.Pattern == null && pattern.LineNumber > 0) {
- DestroyPopup ();
- var doc = IdeApp.Workbench.ActiveDocument;
- if (doc?.GetContent (true) is ITextView view) {
- doc.Select ();
+ project.UserProperties.SetValue("PreferredExecutionTarget", defaultRuntime.ExecutionTarget.Id);
+ return defaultRuntime;
+ }
+
+ void SelectActiveRuntime (RuntimeModel preferedRuntimeModel)
+ {
+ ignoreRuntimeChangedCount++;
+
+ try {
+ if (ToolbarView.RuntimeModel.Any ()) {
+ if (startupProjects.Length > 1) {
+ var multiProjectTarget = new MultiProjectExecutionTarget ();
+ var multipleRuntime = new RuntimeModel (this, multiProjectTarget, false, null);
+ foreach (var startupProject in startupProjects) {
+ var runtimeModel = SelectActiveRuntime (startupProject.Item1, preferedRuntimeModel);
+ if (runtimeModel == null) {
+ LoggingService.LogError ($"No runtimeModel for {startupProject.Item1.Name}");
+ continue;
+ }
+ multiProjectTarget.SetExecutionTarget (startupProject.Item1, runtimeModel.ExecutionTarget);
+ multipleRuntime.AddChild (runtimeModel);
+ }
+ ToolbarView.ActiveRuntime = multipleRuntime;
+ IdeApp.Workspace.ActiveExecutionTarget = multipleRuntime.ExecutionTarget;
+ } else if (startupProjects.Length == 1) {
+ var runtimeModel = SelectActiveRuntime (startupProjects.First ().Item1, preferedRuntimeModel);
+ ToolbarView.ActiveRuntime = runtimeModel;
+ IdeApp.Workspace.ActiveExecutionTarget = runtimeModel?.ExecutionTarget;
+ UpdateBuildConfiguration ();
+ } else {
+ ToolbarView.ActiveRuntime = null;
+ IdeApp.Workspace.ActiveExecutionTarget = null;
+ }
+ }
+ } finally {
+ ignoreRuntimeChangedCount--;
+ }
+ }
+
+ void HandleSolutionLoaded (object sender, EventArgs e)
+ {
+ if (currentSolution != null)
+ return;
+
+ UpdateCombos ();
+ }
+
+ void HandleUpdateCombos (object sender, EventArgs e)
+ {
+
+ UpdateCombos ();
+ }
+
+ void HandleCurrentSelectedSolutionChanged (object sender, SolutionEventArgs e)
+ {
+ if (currentSolution != null) {
+ currentSolution.StartupConfigurationChanged -= HandleStartupItemChanged;
+ currentSolution.Saved -= HandleSolutionSaved;
+ currentSolution.EntrySaved -= HandleSolutionEntrySaved;
+ currentSolution.SolutionItemAdded -= HandleSolutionItemAdded;
+ }
+
+ currentSolution = e.Solution;
+
+ if (currentSolution != null) {
+ currentSolution.StartupConfigurationChanged += HandleStartupItemChanged;
+ currentSolution.Saved += HandleSolutionSaved;
+ currentSolution.EntrySaved += HandleSolutionEntrySaved;
+ currentSolution.SolutionItemAdded += HandleSolutionItemAdded;
+ }
+
+ TrackStartupProject ();
+ }
+
+ void TrackStartupProject ()
+ {
+ Tuple [] projects;
+ if (currentSolution?.StartupConfiguration is MultiItemSolutionRunConfiguration) {
+ var multiRunConfigs = (MultiItemSolutionRunConfiguration)currentSolution.StartupConfiguration;
+ projects = multiRunConfigs.Items.Select (rc => new Tuple (
+ rc.SolutionItem,
+ rc.RunConfiguration
+ )).ToArray ();
+ } else if (currentSolution?.StartupConfiguration is SingleItemSolutionRunConfiguration) {
+ var singleRunConfig = (SingleItemSolutionRunConfiguration)currentSolution.StartupConfiguration;
+ projects = new Tuple []{ new Tuple (
+ singleRunConfig.Item, singleRunConfig.RunConfiguration)};
+ } else {
+ projects = new Tuple [0];
+ }
+ if (!startupProjects.SequenceEqual (projects)) {
+ foreach (var item in startupProjects)
+ item.Item1.ExecutionTargetsChanged -= executionTargetsChanged;
+ foreach (var item in projects)
+ item.Item1.ExecutionTargetsChanged += executionTargetsChanged;
+ startupProjects = projects;
+ }
+ }
+
+ void HandleSolutionSaved (object sender, EventArgs e)
+ {
+ UpdateCombos ();
+ }
+
+ void HandleSolutionEntrySaved (object sender, SolutionItemSavedEventArgs e)
+ {
+ // Skip the per-project update when a solution is being saved. The solution Saved callback will do the final update.
+ if (!e.SavingSolution)
+ HandleSolutionSaved (sender, e);
+ }
+
+ void HandleSolutionItemAdded (object sender, SolutionItemChangeEventArgs e)
+ {
+ // When a solution item is added due to a reload we need to ensure the configurationMergers dictionary is
+ // using the new project and not the old disposed project.
+ if (e.Reloading)
+ UpdateCombos ();
+ }
+
+ void HandleStartupItemChanged (object sender, EventArgs e)
+ {
+ TrackStartupProject ();
+ if (ignoreConfigurationChangedCount == 0)
+ UpdateCombos ();
+ }
+
+ void OnExtensionChanged (object sender, ExtensionEventArgs args)
+ {
+ if (args.PathChanged (ToolbarExtensionPath))
+ RebuildToolbar ();
+ }
+
+ void UpdateSearchEntryLabel ()
+ {
+ var info = IdeApp.CommandService.GetCommand (Commands.NavigateTo);
+ ToolbarView.SearchPlaceholderMessage = !string.IsNullOrEmpty (info.AccelKey) ?
+ GettextCatalog.GetString ("Press \u2018{0}\u2019 to search", KeyBindingManager.BindingToDisplayLabel (info.AccelKey, false)) :
+ GettextCatalog.GetString ("Search solution");
+ }
+
+ SearchPopupWindow popup = null;
+ static readonly SearchPopupSearchPattern emptyColonPattern = SearchPopupSearchPattern.ParsePattern (":");
+ void PositionPopup ()
+ {
+ if (popup == null)
+ return;
+
+ popup.IgnoreRepositionWindow = false;
+
+ var anchor = ToolbarView.PopupAnchor;
+ if (IdeApp.Workbench.RootWindow.Visible)
+ popup.ShowPopup (anchor, PopupPosition.TopRight);
+
+ if (anchor.GdkWindow == null) {
+ var location = new Xwt.Point (anchor.Allocation.X + anchor.Allocation.Width - popup.Size.Width, anchor.Allocation.Y);
+
+ // Need to hard lock the location because Xwt doesn't know that the allocation might be coming from a
+ // Cocoa control and thus has been changed to take macOS monitor layout into consideration
+ popup.IgnoreRepositionWindow = true;
+ popup.Location = location;
+ }
+ }
+
+ void DestroyPopup ()
+ {
+ if (popup != null) {
+ popup.Close ();
+ popup.Destroy ();
+ popup = null;
+ }
+ }
+
+ void HandleSearchEntryChanged (object sender, EventArgs e)
+ {
+ if (!string.IsNullOrEmpty (ToolbarView.SearchText))
+ lastSearchText = ToolbarView.SearchText;
+
+ if (string.IsNullOrEmpty (ToolbarView.SearchText)){
+ DestroyPopup ();
+ return;
+ }
+ var pattern = SearchPopupSearchPattern.ParsePattern (ToolbarView.SearchText);
+ if (pattern.Pattern == null && pattern.LineNumber > 0 || pattern == emptyColonPattern) {
+ if (popup != null) {
+ popup.Hide ();
+ }
+ return;
+ } else {
+ if (popup != null && !popup.Visible)
+ popup.Show ();
+ }
+
+ if (popup == null) {
+ popup = new SearchPopupWindow ();
+ popup.SearchForMembers = SearchForMembers;
+ popup.Disposed += delegate {
+ popup = null;
+ ToolbarView.SearchText = "";
+ };
+ popup.SelectedItemChanged += delegate {
+ var si = popup?.Content?.SelectedItem;
+ if (si == null || !si.IsValid)
+ return;
+ var text = si.DataSource [si.Item].AccessibilityMessage;
+ if (string.IsNullOrEmpty (text))
+ return;
+
+ ToolbarView.ShowAccessibilityAnnouncement (text);
+ };
+ PositionPopup ();
+ popup.Show ();
+ }
+ // popup.Update () is thread safe, so run it on a bg thread for faster results
+ Task.Run (() => popup.Update (pattern)).Ignore ();
+ }
+
+ void HandleSearchEntryActivated (object sender, EventArgs e)
+ {
+ var pattern = SearchPopupSearchPattern.ParsePattern (ToolbarView.SearchText);
+ if (pattern.Pattern == null && pattern.LineNumber > 0) {
+ DestroyPopup ();
+ var doc = IdeApp.Workbench.ActiveDocument;
+ if (doc?.GetContent (true) is ITextView view) {
+ doc.Select ();
var snapshot = view.TextBuffer.CurrentSnapshot;
int lineNumber = Math.Min (Math.Max (1, pattern.LineNumber), snapshot.LineCount);
- var line = snapshot.GetLineFromLineNumber (lineNumber - 1);
+ var line = snapshot.GetLineFromLineNumber (lineNumber - 1);
if (line != null) {
- view.Caret.MoveTo (new SnapshotPoint (snapshot, line.Start + Math.Max (0, Math.Min (pattern.Column - 1, line.Length))));
+ view.Caret.MoveTo (new SnapshotPoint (snapshot, line.Start + Math.Max (0, Math.Min (pattern.Column - 1, line.Length))));
IdeApp.CommandService.DispatchCommand (ViewCommands.CenterAndFocusCurrentDocument);
ToolbarView.SearchText = "";
- }
- }
- return;
- }
- if (popup != null)
- popup.OpenFile ();
- }
-
- void HandleSearchEntryCommand (object sender, SearchEntryCommandArgs args)
- {
- if (args.Command == SearchPopupCommand.Cancel) {
- DestroyPopup ();
- var doc = IdeApp.Workbench.ActiveDocument;
- if (doc != null)
- doc.Select ();
- return;
- }
-
- if (popup != null) {
- args.Handled = popup.ProcessCommand (args.Command);
- }
- }
-
- void HandleSearchEntryKeyPressed (object sender, Xwt.KeyEventArgs e)
- {
+ }
+ }
+ return;
+ }
+ if (popup != null)
+ popup.OpenFile ();
+ }
+
+ void HandleSearchEntryCommand (object sender, SearchEntryCommandArgs args)
+ {
+ if (args.Command == SearchPopupCommand.Cancel) {
+ DestroyPopup ();
+ var doc = IdeApp.Workbench.ActiveDocument;
+ if (doc != null)
+ doc.Select ();
+ return;
+ }
+
+ if (popup != null) {
+ args.Handled = popup.ProcessCommand (args.Command);
+ }
+ }
+
+ void HandleSearchEntryKeyPressed (object sender, Xwt.KeyEventArgs e)
+ {
if (e.Key == Xwt.Key.Escape) {
- DestroyPopup();
- var doc = IdeApp.Workbench.ActiveDocument;
- if (doc != null)
- doc.Select ();
- return;
- }
- if (popup != null)
- e.Handled = popup.ProcessKey (e.Key, e.Modifiers);
- }
-
- string lastSearchText = string.Empty;
- public void FocusSearchBar ()
- {
- IdeApp.Workbench.Present ();
- var text = lastSearchText;
- var doc = IdeApp.Workbench.ActiveDocument;
- if (doc?.GetContent () is ITextView view && !view.Selection.IsEmpty) {
- string selected = view.Selection.SelectedSpans[0].GetText ();
- int whitespaceIndex = selected.TakeWhile (c => !char.IsWhiteSpace (c)).Count ();
- text = selected.Substring (0, whitespaceIndex);
- }
-
- ToolbarView.FocusSearchBar ();
- ToolbarView.SearchText = text;
- }
-
- public void SetSearchCategory (string category)
- {
- IdeApp.Workbench.Present ();
- ToolbarView.SearchCategory = category + ":";
- }
-
- HashSet visibleBars = new HashSet ();
- public void ShowCommandBar (string barId)
- {
- visibleBars.Add (barId);
- RebuildToolbar ();
- }
-
- public void HideCommandBar (string barId)
- {
- visibleBars.Remove (barId);
- RebuildToolbar ();
- }
-
- List buttonBarButtons = new List ();
- void RebuildToolbar ()
- {
- var bars = AddinManager.GetExtensionNodes (ToolbarExtensionPath)
- .Where (n => visibleBars.Contains (n.Id))
- .Select (b => new { Label = b.Label, Buttons = b.ChildNodes.OfType ().Select (n => n.Id) });
-
- var buttonGroups = new List ();
- buttonBarButtons.Clear ();
- foreach (var bar in bars) {
- var group = new ButtonBarGroup (bar.Label);
-
- buttonGroups.Add (group);
- foreach (string commandId in bar.Buttons) {
- var button = new ButtonBarButton (this, commandId);
- group.Buttons.Add (button);
- buttonBarButtons.Add (button);
- }
- }
-
- ToolbarView.RebuildToolbar (buttonGroups);
- }
-
- static void HandleStartButtonClicked (object sender, EventArgs e)
- {
- OperationIcon operation;
- var ci = GetStartButtonCommandInfo (out operation);
- if (ci.Enabled)
- IdeApp.CommandService.DispatchCommand (ci.Command.Id, CommandSource.MainToolbar);
- }
-
- static CommandInfo GetStartButtonCommandInfo (out OperationIcon operation)
- {
- if (!IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted || !IdeApp.ProjectOperations.CurrentBuildOperation.IsCompleted) {
- operation = OperationIcon.Stop;
- return IdeApp.CommandService.GetCommandInfo (MonoDevelop.Ide.Commands.ProjectCommands.Stop);
- }
- else {
- operation = OperationIcon.Run;
- var ci = IdeApp.CommandService.GetCommandInfo ("MonoDevelop.Debugger.DebugCommands.Debug");
- if (!ci.Enabled || !ci.Visible) {
- // If debug is not enabled, try Run
- ci = IdeApp.CommandService.GetCommandInfo (MonoDevelop.Ide.Commands.ProjectCommands.Run);
- if (!ci.Enabled || !ci.Visible) {
- // Running is not possible, then allow building
- var bci = IdeApp.CommandService.GetCommandInfo (MonoDevelop.Ide.Commands.ProjectCommands.BuildSolution);
- if (bci.Enabled && bci.Visible) {
- operation = OperationIcon.Build;
- ci = bci;
- }
- }
- }
- return ci;
- }
- }
-
- #region ICommandBar implementation
- bool toolbarEnabled = true;
- object lastCommandTarget;
-
- void ICommandBar.Update (object activeTarget)
- {
- lastCommandTarget = activeTarget;
- if (!toolbarEnabled)
- return;
- OperationIcon operation;
- var ci = GetStartButtonCommandInfo (out operation);
- if (ci.Enabled != ToolbarView.RunButtonSensitivity)
- ToolbarView.RunButtonSensitivity = ci.Enabled;
-
- ToolbarView.RunButtonIcon = operation;
- var stopped = operation != OperationIcon.Stop;
- if (ToolbarView.ConfigurationPlatformSensitivity != stopped)
- ToolbarView.ConfigurationPlatformSensitivity = stopped;
-
- foreach (var item in buttonBarButtons)
- item.Update ();
- }
-
- void ICommandBar.SetEnabled (bool enabled)
- {
- toolbarEnabled = enabled;
- ToolbarView.RunButtonSensitivity = enabled;
- ToolbarView.SearchSensivitity = enabled;
- ToolbarView.ButtonBarSensitivity = enabled;
- }
- #endregion
-
- class ButtonBarButton : IButtonBarButton
- {
- CommandInfo lastCmdInfo;
- MainToolbarController Controller { get; set; }
- string CommandId { get; set; }
-
- public ButtonBarButton (MainToolbarController controller, string commandId) : this (controller)
- {
- CommandId = commandId;
- }
-
- public ButtonBarButton (MainToolbarController controller)
- {
- Controller = controller;
- }
-
- public IconId Image { get; set; }
- public bool Enabled { get; set; }
- public bool Visible { get; set; }
- public string Tooltip { get; set; }
- public string Title { get; set; }
- public bool IsSeparator {
- get { return CommandId == null; }
- }
-
- public void NotifyPushed ()
- {
- IdeApp.CommandService.DispatchCommand (CommandId, null, Controller.lastCommandTarget, CommandSource.MainToolbar, lastCmdInfo);
- }
-
- public void Update ()
- {
- if (IsSeparator)
- return;
-
- if (lastCmdInfo != null) {
- lastCmdInfo.CancelAsyncUpdate ();
- lastCmdInfo.Changed -= LastCmdInfoChanged;
- }
-
- lastCmdInfo = IdeApp.CommandService.GetCommandInfo (CommandId, new CommandTargetRoute (Controller.lastCommandTarget));
-
- if (lastCmdInfo != null) {
- lastCmdInfo.Changed += LastCmdInfoChanged;
- Update (lastCmdInfo);
- }
- }
-
- void Update (CommandInfo ci)
- {
- if (ci.Icon != Image) {
- Image = ci.Icon;
- if (ImageChanged != null)
- ImageChanged (this, null);
- }
- if (ci.Enabled != Enabled) {
- Enabled = ci.Enabled;
- if (EnabledChanged != null)
- EnabledChanged (this, null);
- }
- if (ci.Description != Tooltip) {
- Tooltip = ci.Description;
- if (TooltipChanged != null)
- TooltipChanged (this, null);
- }
- if (ci.Visible != Visible) {
- Visible = ci.Visible;
- if (VisibleChanged != null)
- VisibleChanged (this, null);
- }
- if (ci.Text != Title) {
- Title = ci.Text;
- TitleChanged?.Invoke (this, null);
- }
- }
-
- void LastCmdInfoChanged (object sender, EventArgs e)
- {
- Update (lastCmdInfo);
- }
-
- public event EventHandler EnabledChanged;
- public event EventHandler ImageChanged;
- public event EventHandler VisibleChanged;
- public event EventHandler TooltipChanged;
- public event EventHandler TitleChanged;
- }
-
- [Serializable]
- class RuntimeModel : IRuntimeModel
- {
- MainToolbarController Controller { get; set; }
- List children = new List ();
- public object Command { get; private set; }
- public ExecutionTarget ExecutionTarget { get; private set; }
- string DisplayText = null;
- string image, tooltip;
- bool fullText;
-
- RuntimeModel (MainToolbarController controller)
- {
- Controller = controller;
- }
-
- public RuntimeModel (MainToolbarController controller, string displayText) : this (controller)
- {
- DisplayText = displayText;
- }
-
- public RuntimeModel (MainToolbarController controller, ActionCommand command) : this (controller)
- {
- Command = command.Id;
- image = command.Icon;
- tooltip = command.Description;
- }
-
- public RuntimeModel (MainToolbarController controller, ExecutionTarget target, bool fullText, SolutionItem project) : this (controller)
- {
- if (target == null)
- throw new ArgumentNullException (nameof (target));
-
- ExecutionTarget = target;
- image = target.Image;
- tooltip = target.Tooltip;
-
- this.fullText = fullText;
- Project = project;
- }
-
- public void AddChild (IRuntimeModel child)
- {
- children.Add (child);
- }
-
- public IEnumerable Children {
- get { return children; }
- }
-
- public bool Notable {
- get { return ExecutionTarget != null && ExecutionTarget.Notable; }
- }
-
- public bool HasChildren {
- get;
- set;
- }
-
- public bool IsSeparator {
- get { return Command == null && ExecutionTarget == null && DisplayText == null; }
- }
-
- public bool IsIndented {
- get;
- set;
- }
-
- public bool NotifyActivated ()
- {
- if (Command != null && IdeApp.CommandService.DispatchCommand (Command, CommandSource.ContextMenu))
- return true;
- return false;
- }
-
- internal string TargetId {
- get {
- if (ExecutionTarget == null)
- return "";
- return ExecutionTarget.Id;
- }
- }
-
- public SolutionItem Project { get; }
-
- public string Image => image;
-
- public string Tooltip => tooltip;
-
- public IRuntimeMutableModel GetMutableModel ()
- {
- if (Command != null)
- return new RuntimeMutableModel (Controller, Command);
- else if (ExecutionTarget != null)
- return new RuntimeMutableModel (ExecutionTarget, fullText);
- else
- return new RuntimeMutableModel (DisplayText);
- }
- }
-
- [Serializable]
- class RuntimeMutableModel : IRuntimeMutableModel
- {
- public RuntimeMutableModel(string text)
- {
- Enabled = Visible = true;
- DisplayString = FullDisplayString = text;
- }
-
- public RuntimeMutableModel (MainToolbarController controller, object command)
- {
- var ci = IdeApp.CommandService.GetCommandInfo (command, new CommandTargetRoute (controller.lastCommandTarget));
- Visible = ci.Visible;
- Enabled = ci.Enabled;
- DisplayString = FullDisplayString = RemoveUnderline (ci.Text);
- }
-
- public RuntimeMutableModel (ExecutionTarget target, bool fullName)
- {
- Enabled = !(target is ExecutionTargetGroup) && target.Enabled;
- Visible = true;
- if (target == null)
- DisplayString = FullDisplayString = string.Empty;
- else {
- FullDisplayString = target.FullName;
- DisplayString = fullName ? target.FullName : target.Name;
- }
- }
-
- // Marker so it won't be reused.
- public void Dispose ()
- {
- }
-
- public bool Visible {
- get;
- private set;
- }
-
- public bool Enabled {
- get;
- private set;
- }
-
- public string DisplayString {
- get;
- private set;
- }
-
- public string FullDisplayString {
- get;
- private set;
- }
-
- static string RemoveUnderline (string s)
- {
- int i = s.IndexOf ('_');
- if (i == -1)
- return s;
- var sb = StringBuilderCache.Allocate ();
- sb.Append (s, 0, i);
- for (; i < s.Length; i++) {
- if (s [i] == '_') {
- i++;
- if (i >= s.Length)
- break;
- }
- sb.Append (s [i]);
- }
- return StringBuilderCache.ReturnAndFree (sb);
- }
- }
-
- [Serializable]
- class ConfigurationModel : IConfigurationModel
- {
- public ConfigurationModel (string originalId)
- {
- OriginalId = originalId;
- DisplayString = originalId.Replace ("|", " | ");
- }
-
- public string OriginalId { get; private set; }
- public string DisplayString { get; private set; }
- }
-
- [Serializable]
- class RunConfigurationModel : IRunConfigurationModel
- {
- public RunConfigurationModel (SolutionRunConfiguration config)
- {
- RunConfiguration = config;
- OriginalId = config.Id;
- DisplayString = config.Name;
- }
-
- public SolutionRunConfiguration RunConfiguration { get; set; }
- public string OriginalId { get; private set; }
- public string DisplayString { get; private set; }
- }
-
- class SearchMenuModel : ISearchMenuModel
- {
- public SearchMenuModel (string displayString, string category)
- {
- DisplayString = displayString;
- Category = category;
- }
-
- public void NotifyActivated ()
- {
- if (Activated != null)
- Activated (null, null);
- }
-
- public string DisplayString { get; private set; }
- public string Category { get; set; }
- public event EventHandler Activated;
- }
- }
-
- public class SearchEntryCommandArgs : HandledEventArgs
- {
- public SearchPopupCommand Command { get; private set; }
-
- public SearchEntryCommandArgs (SearchPopupCommand command)
- {
- Command = command;
- }
- }
-}
-
+ DestroyPopup();
+ var doc = IdeApp.Workbench.ActiveDocument;
+ if (doc != null)
+ doc.Select ();
+ return;
+ }
+ if (popup != null)
+ e.Handled = popup.ProcessKey (e.Key, e.Modifiers);
+ }
+
+ string lastSearchText = string.Empty;
+ public void FocusSearchBar ()
+ {
+ IdeApp.Workbench.Present ();
+ var text = lastSearchText;
+ var doc = IdeApp.Workbench.ActiveDocument;
+ if (doc?.GetContent () is ITextView view && !view.Selection.IsEmpty) {
+ string selected = view.Selection.SelectedSpans[0].GetText ();
+ int whitespaceIndex = selected.TakeWhile (c => !char.IsWhiteSpace (c)).Count ();
+ text = selected.Substring (0, whitespaceIndex);
+ }
+
+ ToolbarView.FocusSearchBar ();
+ ToolbarView.SearchText = text;
+ }
+
+ public void SetSearchCategory (string category)
+ {
+ IdeApp.Workbench.Present ();
+ ToolbarView.SearchCategory = category + ":";
+ }
+
+ HashSet visibleBars = new HashSet ();
+ public void ShowCommandBar (string barId)
+ {
+ visibleBars.Add (barId);
+ RebuildToolbar ();
+ }
+
+ public void HideCommandBar (string barId)
+ {
+ visibleBars.Remove (barId);
+ RebuildToolbar ();
+ }
+
+ List buttonBarButtons = new List ();
+ void RebuildToolbar ()
+ {
+ var bars = AddinManager.GetExtensionNodes (ToolbarExtensionPath)
+ .Where (n => visibleBars.Contains (n.Id))
+ .Select (b => new { Label = b.Label, Buttons = b.ChildNodes.OfType ().Select (n => n.Id) });
+
+ var buttonGroups = new List ();
+ buttonBarButtons.Clear ();
+ foreach (var bar in bars) {
+ var group = new ButtonBarGroup (bar.Label);
+
+ buttonGroups.Add (group);
+ foreach (string commandId in bar.Buttons) {
+ var button = new ButtonBarButton (this, commandId);
+ group.Buttons.Add (button);
+ buttonBarButtons.Add (button);
+ }
+ }
+
+ ToolbarView.RebuildToolbar (buttonGroups);
+ }
+
+ static void HandleStartButtonClicked (object sender, EventArgs e)
+ {
+ OperationIcon operation;
+ var ci = GetStartButtonCommandInfo (out operation);
+ if (ci.Enabled)
+ IdeApp.CommandService.DispatchCommand (ci.Command.Id, CommandSource.MainToolbar);
+ }
+
+ static CommandInfo GetStartButtonCommandInfo (out OperationIcon operation)
+ {
+ if (!IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted || !IdeApp.ProjectOperations.CurrentBuildOperation.IsCompleted) {
+ operation = OperationIcon.Stop;
+ return IdeApp.CommandService.GetCommandInfo (MonoDevelop.Ide.Commands.ProjectCommands.Stop);
+ }
+ else {
+ operation = OperationIcon.Run;
+ var ci = IdeApp.CommandService.GetCommandInfo ("MonoDevelop.Debugger.DebugCommands.Debug");
+ if (!ci.Enabled || !ci.Visible) {
+ // If debug is not enabled, try Run
+ ci = IdeApp.CommandService.GetCommandInfo (MonoDevelop.Ide.Commands.ProjectCommands.Run);
+ if (!ci.Enabled || !ci.Visible) {
+ // Running is not possible, then allow building
+ var bci = IdeApp.CommandService.GetCommandInfo (MonoDevelop.Ide.Commands.ProjectCommands.BuildSolution);
+ if (bci.Enabled && bci.Visible) {
+ operation = OperationIcon.Build;
+ ci = bci;
+ }
+ }
+ }
+ return ci;
+ }
+ }
+
+ #region ICommandBar implementation
+ bool toolbarEnabled = true;
+ object lastCommandTarget;
+
+ void ICommandBar.Update (object activeTarget)
+ {
+ lastCommandTarget = activeTarget;
+ if (!toolbarEnabled)
+ return;
+ OperationIcon operation;
+ var ci = GetStartButtonCommandInfo (out operation);
+ if (ci.Enabled != ToolbarView.RunButtonSensitivity)
+ ToolbarView.RunButtonSensitivity = ci.Enabled;
+
+ ToolbarView.RunButtonIcon = operation;
+ var stopped = operation != OperationIcon.Stop;
+ if (ToolbarView.ConfigurationPlatformSensitivity != stopped)
+ ToolbarView.ConfigurationPlatformSensitivity = stopped;
+
+ foreach (var item in buttonBarButtons)
+ item.Update ();
+ }
+
+ void ICommandBar.SetEnabled (bool enabled)
+ {
+ toolbarEnabled = enabled;
+ ToolbarView.RunButtonSensitivity = enabled;
+ ToolbarView.SearchSensivitity = enabled;
+ ToolbarView.ButtonBarSensitivity = enabled;
+ }
+ #endregion
+
+ class ButtonBarButton : IButtonBarButton
+ {
+ CommandInfo lastCmdInfo;
+ MainToolbarController Controller { get; set; }
+ string CommandId { get; set; }
+
+ public ButtonBarButton (MainToolbarController controller, string commandId) : this (controller)
+ {
+ CommandId = commandId;
+ }
+
+ public ButtonBarButton (MainToolbarController controller)
+ {
+ Controller = controller;
+ }
+
+ public IconId Image { get; set; }
+ public bool Enabled { get; set; }
+ public bool Visible { get; set; }
+ public string Tooltip { get; set; }
+ public string Title { get; set; }
+ public bool IsSeparator {
+ get { return CommandId == null; }
+ }
+
+ public void NotifyPushed ()
+ {
+ IdeApp.CommandService.DispatchCommand (CommandId, null, Controller.lastCommandTarget, CommandSource.MainToolbar, lastCmdInfo);
+ }
+
+ public void Update ()
+ {
+ if (IsSeparator)
+ return;
+
+ if (lastCmdInfo != null) {
+ lastCmdInfo.CancelAsyncUpdate ();
+ lastCmdInfo.Changed -= LastCmdInfoChanged;
+ }
+
+ lastCmdInfo = IdeApp.CommandService.GetCommandInfo (CommandId, new CommandTargetRoute (Controller.lastCommandTarget));
+
+ if (lastCmdInfo != null) {
+ lastCmdInfo.Changed += LastCmdInfoChanged;
+ Update (lastCmdInfo);
+ }
+ }
+
+ void Update (CommandInfo ci)
+ {
+ if (ci.Icon != Image) {
+ Image = ci.Icon;
+ if (ImageChanged != null)
+ ImageChanged (this, null);
+ }
+ if (ci.Enabled != Enabled) {
+ Enabled = ci.Enabled;
+ if (EnabledChanged != null)
+ EnabledChanged (this, null);
+ }
+ if (ci.Description != Tooltip) {
+ Tooltip = ci.Description;
+ if (TooltipChanged != null)
+ TooltipChanged (this, null);
+ }
+ if (ci.Visible != Visible) {
+ Visible = ci.Visible;
+ if (VisibleChanged != null)
+ VisibleChanged (this, null);
+ }
+ if (ci.Text != Title) {
+ Title = ci.Text;
+ TitleChanged?.Invoke (this, null);
+ }
+ }
+
+ void LastCmdInfoChanged (object sender, EventArgs e)
+ {
+ Update (lastCmdInfo);
+ }
+
+ public event EventHandler EnabledChanged;
+ public event EventHandler ImageChanged;
+ public event EventHandler VisibleChanged;
+ public event EventHandler TooltipChanged;
+ public event EventHandler TitleChanged;
+ }
+
+ [Serializable]
+ class RuntimeModel : IRuntimeModel
+ {
+ MainToolbarController Controller { get; set; }
+ List children = new List ();
+ public object Command { get; private set; }
+ public ExecutionTarget ExecutionTarget { get; private set; }
+ string DisplayText = null;
+ string image, tooltip;
+ bool fullText;
+
+ RuntimeModel (MainToolbarController controller)
+ {
+ Controller = controller;
+ }
+
+ public RuntimeModel (MainToolbarController controller, string displayText) : this (controller)
+ {
+ DisplayText = displayText;
+ }
+
+ public RuntimeModel (MainToolbarController controller, ActionCommand command) : this (controller)
+ {
+ Command = command.Id;
+ image = command.Icon;
+ tooltip = command.Description;
+ }
+
+ public RuntimeModel (MainToolbarController controller, ExecutionTarget target, bool fullText, SolutionItem project) : this (controller)
+ {
+ if (target == null)
+ throw new ArgumentNullException (nameof (target));
+
+ ExecutionTarget = target;
+ image = target.Image;
+ tooltip = target.Tooltip;
+
+ this.fullText = fullText;
+ Project = project;
+ }
+
+ public void AddChild (IRuntimeModel child)
+ {
+ children.Add (child);
+ }
+
+ public IEnumerable Children {
+ get { return children; }
+ }
+
+ public bool Notable {
+ get { return ExecutionTarget != null && ExecutionTarget.Notable; }
+ }
+
+ public bool HasChildren {
+ get;
+ set;
+ }
+
+ public bool IsSeparator {
+ get { return Command == null && ExecutionTarget == null && DisplayText == null; }
+ }
+
+ public bool IsIndented {
+ get;
+ set;
+ }
+
+ public bool NotifyActivated ()
+ {
+ if (Command != null && IdeApp.CommandService.DispatchCommand (Command, CommandSource.ContextMenu))
+ return true;
+ return false;
+ }
+
+ internal string TargetId {
+ get {
+ if (ExecutionTarget == null)
+ return "";
+ return ExecutionTarget.Id;
+ }
+ }
+
+ public SolutionItem Project { get; }
+
+ public string Image => image;
+
+ public string Tooltip => tooltip;
+
+ public IRuntimeMutableModel GetMutableModel ()
+ {
+ if (Command != null)
+ return new RuntimeMutableModel (Controller, Command);
+ else if (ExecutionTarget != null)
+ return new RuntimeMutableModel (ExecutionTarget, fullText);
+ else
+ return new RuntimeMutableModel (DisplayText);
+ }
+ }
+
+ [Serializable]
+ class RuntimeMutableModel : IRuntimeMutableModel
+ {
+ public RuntimeMutableModel(string text)
+ {
+ Enabled = Visible = true;
+ DisplayString = FullDisplayString = text;
+ }
+
+ public RuntimeMutableModel (MainToolbarController controller, object command)
+ {
+ var ci = IdeApp.CommandService.GetCommandInfo (command, new CommandTargetRoute (controller.lastCommandTarget));
+ Visible = ci.Visible;
+ Enabled = ci.Enabled;
+ DisplayString = FullDisplayString = RemoveUnderline (ci.Text);
+ }
+
+ public RuntimeMutableModel (ExecutionTarget target, bool fullName)
+ {
+ Enabled = !(target is ExecutionTargetGroup) && target.Enabled;
+ Visible = true;
+ if (target == null)
+ DisplayString = FullDisplayString = string.Empty;
+ else {
+ FullDisplayString = target.FullName;
+ DisplayString = fullName ? target.FullName : target.Name;
+ }
+ }
+
+ // Marker so it won't be reused.
+ public void Dispose ()
+ {
+ }
+
+ public bool Visible {
+ get;
+ private set;
+ }
+
+ public bool Enabled {
+ get;
+ private set;
+ }
+
+ public string DisplayString {
+ get;
+ private set;
+ }
+
+ public string FullDisplayString {
+ get;
+ private set;
+ }
+
+ static string RemoveUnderline (string s)
+ {
+ int i = s.IndexOf ('_');
+ if (i == -1)
+ return s;
+ var sb = StringBuilderCache.Allocate ();
+ sb.Append (s, 0, i);
+ for (; i < s.Length; i++) {
+ if (s [i] == '_') {
+ i++;
+ if (i >= s.Length)
+ break;
+ }
+ sb.Append (s [i]);
+ }
+ return StringBuilderCache.ReturnAndFree (sb);
+ }
+ }
+
+ [Serializable]
+ class ConfigurationModel : IConfigurationModel
+ {
+ public ConfigurationModel (string originalId)
+ {
+ OriginalId = originalId;
+ DisplayString = originalId.Replace ("|", " | ");
+ }
+
+ public string OriginalId { get; private set; }
+ public string DisplayString { get; private set; }
+ }
+
+ [Serializable]
+ class RunConfigurationModel : IRunConfigurationModel
+ {
+ public RunConfigurationModel (SolutionRunConfiguration config)
+ {
+ RunConfiguration = config;
+ OriginalId = config.Id;
+ DisplayString = config.Name;
+ }
+
+ public SolutionRunConfiguration RunConfiguration { get; set; }
+ public string OriginalId { get; private set; }
+ public string DisplayString { get; private set; }
+ }
+
+ class SearchMenuModel : ISearchMenuModel
+ {
+ public SearchMenuModel (string displayString, string category)
+ {
+ DisplayString = displayString;
+ Category = category;
+ }
+
+ public void NotifyActivated ()
+ {
+ if (Activated != null)
+ Activated (null, null);
+ }
+
+ public string DisplayString { get; private set; }
+ public string Category { get; set; }
+ public event EventHandler Activated;
+ }
+ }
+
+ public class SearchEntryCommandArgs : HandledEventArgs
+ {
+ public SearchPopupCommand Command { get; private set; }
+
+ public SearchEntryCommandArgs (SearchPopupCommand command)
+ {
+ Command = command;
+ }
+ }
+}
+
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/GtkWorkarounds.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/GtkWorkarounds.cs
index 8e8de3984e2..d79ba003f57 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/GtkWorkarounds.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/GtkWorkarounds.cs
@@ -1,4 +1,4 @@
-//
+//
// GtkWorkarounds.cs
//
// Authors: Jeffrey Stedfast
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
index 9329838e2c6..558bd7d6a84 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
@@ -1,4 +1,4 @@
-
+
@@ -17,7 +17,10 @@
-
+
+ $(MSBuildProgramFiles32)\Mono\lib\mono\monodoc\monodoc.dll
+ True
+
@@ -133,7 +136,7 @@
{288994D1-C7E1-4740-99AB-A52B572EBA8A}
MonoDevelop.GtkExtensions
-
+
{8F0B736F-8353-4A6C-B471-192D826BDD81}
Xwt.GtkSharp
@@ -158,7 +161,6 @@
-
@@ -166,7 +168,6 @@
-
@@ -179,13 +180,11 @@
-
-
@@ -197,7 +196,6 @@
-
@@ -212,7 +210,6 @@
-
@@ -226,7 +223,6 @@
-
@@ -248,8 +244,6 @@
-
-
@@ -1602,7 +1596,7 @@
-
+
@@ -1611,4 +1605,4 @@
-
+
\ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs
index 389cdd31e81..bbf2bd58a1c 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs
@@ -1,4 +1,4 @@
-//
+//
// IdeStartup.cs
//
// Author:
diff --git a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.MSBuildBuilder.csproj b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.MSBuildBuilder.csproj
index 798cc32593b..18db4a9d8b4 100644
--- a/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.MSBuildBuilder.csproj
+++ b/main/src/core/MonoDevelop.Projects.Formats.MSBuild/MonoDevelop.MSBuildBuilder.csproj
@@ -47,7 +47,7 @@
-
+
PreserveNewest
MonoDevelop.MSBuildBuilder.exe.config
diff --git a/main/winbuild-debug.bat b/main/winbuild-debug.bat
index a6455892ee6..5cb30859a19 100644
--- a/main/winbuild-debug.bat
+++ b/main/winbuild-debug.bat
@@ -1,4 +1,4 @@
setlocal
-set CONFIG=DebugWin32
+set CONFIG=DebugGnome
call winbuild.bat %*
endlocal