diff options
author | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-07-15 12:52:47 +0400 |
---|---|---|
committer | Michael Hutchinson <m.j.hutchinson@gmail.com> | 2011-07-17 17:08:51 +0400 |
commit | e32ededdecb29ed6f18f0e094daa54a358b52cf5 (patch) | |
tree | 3db57ba875c6260cffcf76d8ac156088cdc54618 /main/src/core | |
parent | 584eeb946d4041d3cbf81bcbafa457958e645292 (diff) |
[Core] Move Platform detection code to Platform class
This means we can detect the platform without initializing
the PropertyService.
Diffstat (limited to 'main/src/core')
38 files changed, 126 insertions, 85 deletions
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Platform.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Platform.cs index 8c3a5abea9..aeb4d7c19e 100755 --- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Platform.cs +++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Platform.cs @@ -31,7 +31,7 @@ using Gdk; namespace Mono.TextEditor { - public static class Platform + static class Platform { static Platform () { @@ -171,4 +171,4 @@ namespace Mono.TextEditor return groupZeroMappings[mappedKey] = mappedKey; } } -} +}
\ No newline at end of file diff --git a/main/src/core/MonoDevelop.Core/Makefile.am b/main/src/core/MonoDevelop.Core/Makefile.am index 8e6957625b..fdab67e846 100644 --- a/main/src/core/MonoDevelop.Core/Makefile.am +++ b/main/src/core/MonoDevelop.Core/Makefile.am @@ -161,6 +161,7 @@ FILES = \ MonoDevelop.Core/ICustomXmlSerializer.cs \ MonoDevelop.Core/IProgressMonitor.cs \ MonoDevelop.Core/LoggingService.cs \ + MonoDevelop.Core/Platform.cs \ MonoDevelop.Core/Properties.cs \ MonoDevelop.Core/PropertyBag.cs \ MonoDevelop.Core/PropertyChangedEventArgs.cs \ diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.AddIns/PlatformCondition.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.AddIns/PlatformCondition.cs index 0ad579b25d..35375f120c 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.AddIns/PlatformCondition.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.AddIns/PlatformCondition.cs @@ -43,14 +43,14 @@ namespace MonoDevelop.Core.AddIns switch (plat.ToLower ()) { case "windows": case "win32": - result = PropertyService.IsWindows; break; + result = Platform.IsWindows; break; case "mac": case "macos": case "macosx": - result = PropertyService.IsMac; break; + result = Platform.IsMac; break; case "unix": case "linux": - result = !PropertyService.IsMac && !PropertyService.IsWindows; break; + result = !Platform.IsMac && !Platform.IsWindows; break; default: result = false; break; } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntimeFactory.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntimeFactory.cs index beb57dd23f..803debfb5e 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntimeFactory.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MonoTargetRuntimeFactory.cs @@ -51,14 +51,14 @@ namespace MonoDevelop.Core.Assemblies if (currentRuntime != null) { yield return new MonoTargetRuntime (currentRuntime); } - if (PropertyService.IsWindows) { + if (Platform.IsWindows) { string progs = Environment.GetFolderPath (Environment.SpecialFolder.ProgramFiles); foreach (string dir in Directory.GetDirectories (progs, "Mono-*")) { MonoRuntimeInfo info = new MonoRuntimeInfo (dir); if (info.IsValidRuntime) yield return new MonoTargetRuntime (info); } - } else if (PropertyService.IsMac) { + } else if (Platform.IsMac) { if (!Directory.Exists (MAC_FRAMEWORK_DIR)) yield break; foreach (string dir in Directory.GetDirectories (MAC_FRAMEWORK_DIR)) { diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MsNetTargetRuntimeFactory.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MsNetTargetRuntimeFactory.cs index fdeae46d5f..087c84f5b2 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MsNetTargetRuntimeFactory.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/MsNetTargetRuntimeFactory.cs @@ -34,7 +34,7 @@ namespace MonoDevelop.Core.Assemblies { public System.Collections.Generic.IEnumerable<TargetRuntime> CreateRuntimes () { - if (!PropertyService.IsWindows) + if (!Platform.IsWindows) yield break; if (Type.GetType ("Mono.Runtime") == null) { yield return new MsNetTargetRuntime (true); diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/TargetFrameworkBackend.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/TargetFrameworkBackend.cs index c4bd9cd9f5..10143d6475 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/TargetFrameworkBackend.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Assemblies/TargetFrameworkBackend.cs @@ -70,7 +70,7 @@ namespace MonoDevelop.Core.Assemblies { foreach (string path in runtime.GetToolsPaths (framework)) { string toolPath = Path.Combine (path, toolName); - if (PropertyService.IsWindows) { + if (Platform.IsWindows) { if (File.Exists (toolPath + ".bat")) return toolPath + ".bat"; } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessExtensions.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessExtensions.cs index 4cad19cef2..4cee7da162 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessExtensions.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessExtensions.cs @@ -34,7 +34,7 @@ namespace MonoDevelop.Core.Execution { public static void KillProcessTree (this Process p) { - if (PropertyService.IsWindows) { + if (Platform.IsWindows) { var procRelations = GetProcRelations (); foreach (int pid in GetAllChildren (procRelations, p.Id)) { diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessService.cs index d3db131e8d..f0801cfca4 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/ProcessService.cs @@ -418,7 +418,7 @@ namespace MonoDevelop.Core.Execution if (exited != null) exited (op, null); - if (!PropertyService.IsWindows && Mono.Unix.Native.Syscall.WIFSIGNALED (operation.ExitCode)) + if (!Platform.IsWindows && Mono.Unix.Native.Syscall.WIFSIGNALED (operation.ExitCode)) console.Log.WriteLine (GettextCatalog.GetString ("The application was terminated by a signal: {0}"), Mono.Unix.Native.Syscall.WTERMSIG (operation.ExitCode)); else if (operation.ExitCode != 0) console.Log.WriteLine (GettextCatalog.GetString ("The application exited with code: {0}"), operation.ExitCode); diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/RemotingService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/RemotingService.cs index b7da280807..76cae79259 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/RemotingService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/RemotingService.cs @@ -103,7 +103,7 @@ namespace MonoDevelop.Core.Execution // This is a workaround to a serialization interoperability issue between Mono and .NET // For some reason, .NET is unable to resolve add-in assemblies referenced in // serialized objects, when the assemblies are not in the main bin directory - if (PropertyService.IsWindows) { + if (Platform.IsWindows) { AppDomain.CurrentDomain.AssemblyResolve += delegate (object s, ResolveEventArgs args) { if (!simpleResolveAssemblies.Contains (args.Name)) return null; diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Instrumentation/InstrumentationService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Instrumentation/InstrumentationService.cs index 43b00f73ee..fa77cc8255 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Instrumentation/InstrumentationService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Instrumentation/InstrumentationService.cs @@ -79,7 +79,7 @@ namespace MonoDevelop.Core.Instrumentation if (publicPort == -1) throw new InvalidOperationException ("Service not published"); - if (PropertyService.IsMac) { + if (Platform.IsMac) { var macOSDir = PropertyService.EntryAssemblyPath.ParentDirectory.ParentDirectory.ParentDirectory; var app = macOSDir.Combine ("MDMonitor.app"); if (Directory.Exists (app)) { diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Setup/AddinSetupService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Setup/AddinSetupService.cs index a445f3fc82..47d5364418 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Setup/AddinSetupService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Setup/AddinSetupService.cs @@ -58,9 +58,9 @@ namespace MonoDevelop.Core.Setup public string GetMainRepositoryUrl (UpdateLevel level) { string platform; - if (PropertyService.IsWindows) + if (Platform.IsWindows) platform = "Win32"; - else if (PropertyService.IsMac) + else if (Platform.IsMac) platform = "Mac"; else platform = "Linux"; diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj index 5728b07a38..e5070e6e47 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj @@ -502,6 +502,7 @@ <Compile Include="MonoDevelop.Core\IApplicationInfo.cs" /> <Compile Include="MonoDevelop.Core\ApplicationService.cs" /> <Compile Include="MonoDevelop.Core.ProgressMonitoring\ProgressStatusMonitor.cs" /> + <Compile Include="MonoDevelop.Core\Platform.cs" /> </ItemGroup> <ItemGroup> <None Include="ChangeLog" /> diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FilePath.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FilePath.cs index 0ce1d1f6ac..d1a591e12b 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FilePath.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FilePath.cs @@ -123,7 +123,7 @@ namespace MonoDevelop.Core public bool IsChildPathOf (FilePath basePath)
{
- StringComparison sc = PropertyService.IsWindows ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
+ StringComparison sc = Platform.IsWindows ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
if (basePath.fileName [basePath.fileName.Length - 1] != Path.DirectorySeparatorChar)
return fileName.StartsWith (basePath.fileName + Path.DirectorySeparatorChar, sc); else
@@ -202,7 +202,7 @@ namespace MonoDevelop.Core public static bool operator == (FilePath name1, FilePath name2)
{
- if (PropertyService.IsWindows)
+ if (Platform.IsWindows)
return string.Equals (name1.fileName, name2.fileName, StringComparison.OrdinalIgnoreCase);
else
return string.Equals (name1.fileName, name2.fileName, StringComparison.Ordinal);
@@ -226,7 +226,7 @@ namespace MonoDevelop.Core { if (fileName == null) return 0;
- if (PropertyService.IsWindows)
+ if (Platform.IsWindows)
return fileName.ToLower ().GetHashCode ();
else
return fileName.GetHashCode ();
@@ -239,7 +239,7 @@ namespace MonoDevelop.Core public int CompareTo (FilePath filePath)
{
- return string.Compare (fileName, filePath.fileName, PropertyService.IsWindows);
+ return string.Compare (fileName, filePath.fileName, Platform.IsWindows);
}
int IComparable.CompareTo (object obj)
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs index a19ecb5d70..3b632197e0 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/FileService.cs @@ -362,7 +362,7 @@ namespace MonoDevelop.Core public static void SystemRename (string sourceFile, string destFile)
{ //FIXME: use the atomic System.IO.File.Replace on NTFS
- if (PropertyService.IsWindows) {
+ if (Platform.IsWindows) {
string wtmp = null;
if (File.Exists (destFile)) {
do {
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Gettext.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Gettext.cs index 347f0544e3..8298383a99 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Gettext.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Gettext.cs @@ -44,7 +44,7 @@ namespace MonoDevelop.Core // Set the user defined language string lang = PropertyService.Get ("MonoDevelop.Ide.UserInterfaceLanguage", ""); if (!string.IsNullOrEmpty (lang)) {
- if (PropertyService.IsWindows) {
+ if (Platform.IsWindows) {
lang = lang.Replace("_", "-");
CultureInfo ci = CultureInfo.GetCultureInfo(lang);
if (ci.IsNeutralCulture) {
@@ -65,7 +65,7 @@ namespace MonoDevelop.Core if (string.IsNullOrEmpty (catalog)) { string location = System.Reflection.Assembly.GetExecutingAssembly ().Location; location = Path.GetDirectoryName (location); - if (PropertyService.IsWindows) { + if (Platform.IsWindows) { // On windows, load the catalog from a child dir catalog = Path.Combine (location, "locale"); } diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Platform.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Platform.cs new file mode 100644 index 0000000000..6bf6e3270b --- /dev/null +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Platform.cs @@ -0,0 +1,68 @@ +// +// Platform.cs +// +// Author: +// Michael Hutchinson <mhutch@xamarin.com> +// +// Copyright (c) 2011 Xamarin Inc. (http://xamarin.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.Runtime.InteropServices; +using System.IO; +using System.Text; + +namespace MonoDevelop.Core +{ + public static class Platform + { + public readonly static bool IsWindows; + public readonly static bool IsMac; + + static Platform () + { + IsWindows = Path.DirectorySeparatorChar == '\\'; + IsMac = !IsWindows && IsRunningOnMac (); + } + + //From Managed.Windows.Forms/XplatUI + static bool IsRunningOnMac () + { + IntPtr buf = IntPtr.Zero; + try { + buf = Marshal.AllocHGlobal (8192); + // This is a hacktastic way of getting sysname from uname () + if (uname (buf) == 0) { + string os = System.Runtime.InteropServices.Marshal.PtrToStringAnsi (buf); + if (os == "Darwin") + return true; + } + } catch { + } finally { + if (buf != IntPtr.Zero) + System.Runtime.InteropServices.Marshal.FreeHGlobal (buf); + } + return false; + } + + [DllImport ("libc")] + static extern int uname (IntPtr buf); + } +}
\ No newline at end of file diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs index 904e9ddd7f..495fd8cbf9 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs @@ -42,9 +42,6 @@ namespace MonoDevelop.Core readonly static string FileName = "MonoDevelopProperties.xml"; static Properties properties;
- public readonly static bool IsWindows;
- public readonly static bool IsMac;
-
public static Properties GlobalInstance { get { return properties; } } @@ -73,36 +70,10 @@ namespace MonoDevelop.Core } } - //From Managed.Windows.Forms/XplatUI - static bool IsRunningOnMac () - { - IntPtr buf = IntPtr.Zero; - try { - buf = System.Runtime.InteropServices.Marshal.AllocHGlobal (8192); - // This is a hacktastic way of getting sysname from uname () - if (uname (buf) == 0) { - string os = System.Runtime.InteropServices.Marshal.PtrToStringAnsi (buf); - if (os == "Darwin") - return true; - } - } catch { - } finally { - if (buf != IntPtr.Zero) - System.Runtime.InteropServices.Marshal.FreeHGlobal (buf); - } - return false; - } - - [System.Runtime.InteropServices.DllImport ("libc")] - static extern int uname (IntPtr buf); - static PropertyService () { Counters.PropertyServiceInitialization.BeginTiming (); - IsWindows = Path.DirectorySeparatorChar == '\\'; - IsMac = !IsWindows && IsRunningOnMac (); - FilePath testProfileRoot = Environment.GetEnvironmentVariable ("MONODEVELOP_PROFILE"); if (!testProfileRoot.IsNullOrEmpty) { Locations = UserDataLocations.ForTest (CURRENT_PROFILE_VERSION, testProfileRoot); @@ -151,9 +122,9 @@ namespace MonoDevelop.Core static UserDataLocations GetLocations (string profileVersion) { - if (IsWindows) + if (Platform.IsWindows) return UserDataLocations.ForWindows (profileVersion); - else if (IsMac) + else if (Platform.IsMac) return UserDataLocations.ForMac (profileVersion); else return UserDataLocations.ForUnix (profileVersion); diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs index afa421483c..b293bedfae 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core/Runtime.cs @@ -57,7 +57,7 @@ namespace MonoDevelop.Core Counters.RuntimeInitialization.BeginTiming (); SetupInstrumentation (); - if (PropertyService.IsMac) + if (Platform.IsMac) InitMacFoundation (); // Set a default sync context @@ -134,9 +134,9 @@ namespace MonoDevelop.Core internal static string GetRepoUrl (string quality) { string platform; - if (PropertyService.IsWindows) + if (Platform.IsWindows) platform = "Win32"; - else if (PropertyService.IsMac) + else if (Platform.IsMac) platform = "Mac"; else platform = "Linux"; diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectService.cs index ee98cd1287..1710137884 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectService.cs @@ -303,13 +303,13 @@ namespace MonoDevelop.Projects.Formats.MSBuild return false; string path = relPath; - if (!PropertyService.IsWindows) + if (!Platform.IsWindows) path = path.Replace ("\\", "/"); path = UnscapeString (path); if (char.IsLetter (path [0]) && path.Length > 1 && path[1] == ':') { - if (PropertyService.IsWindows) { + if (Platform.IsWindows) { resultPath = path; // Return the escaped value return true; } else @@ -324,7 +324,7 @@ namespace MonoDevelop.Projects.Formats.MSBuild return true; } - if (Path.IsPathRooted (path) && !PropertyService.IsWindows) { + if (Path.IsPathRooted (path) && !Platform.IsWindows) { // Windows paths are case-insensitive. When mapping an absolute path // we can try to find the correct case for the path. diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/HelpService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/HelpService.cs index b7173f1f3d..1986fd3f7e 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/HelpService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/HelpService.cs @@ -73,7 +73,7 @@ namespace MonoDevelop.Projects helpTree = RootTree.LoadTree (); //FIXME: don't do this when monodoc itself does it or we'll get duplicates! - if (PropertyService.IsMac) + if (Platform.IsMac) sources.Add ("/Library/Frameworks/Mono.framework/External/monodoc"); foreach (var node in AddinManager.GetExtensionNodes ("/MonoDevelop/ProjectModel/MonoDocSources")) diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs index c63974249f..92918a993c 100644 --- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs +++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectService.cs @@ -621,7 +621,7 @@ namespace MonoDevelop.Projects string GetTargetFile (string file) { - if (!PropertyService.IsWindows) { + if (!Platform.IsWindows) { try { UnixSymbolicLinkInfo fi = new UnixSymbolicLinkInfo (file); if (fi.IsSymbolicLink) diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandCodon.cs index b84dc02dff..b4e25d6582 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandCodon.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands.ExtensionNodes/CommandCodon.cs @@ -152,7 +152,7 @@ namespace MonoDevelop.Components.Commands.ExtensionNodes if (icon != null) cmd.Icon = GetStockId (Addin, icon); - cmd.AccelKey = KeyBindingManager.CanonicalizeBinding (PropertyService.IsMac? macShortcut : shortcut); + cmd.AccelKey = KeyBindingManager.CanonicalizeBinding (Platform.IsMac? macShortcut : shortcut); cmd.DisabledVisible = disabledVisible; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingManager.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingManager.cs index 19a717dad2..e96a314acb 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingManager.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingManager.cs @@ -76,7 +76,7 @@ namespace MonoDevelop.Components.Commands static Gdk.Keymap keymap = Gdk.Keymap.Default; static bool isMac { - get { return MonoDevelop.Core.PropertyService.IsMac; } + get { return MonoDevelop.Core.Platform.IsMac; } } public void Dispose () diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingService.cs index 07ff1d95fe..ba103a723f 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/KeyBindingService.cs @@ -63,7 +63,7 @@ namespace MonoDevelop.Components.Commands static string ConfigFileName { get { - string file = PropertyService.IsMac? "Custom.mac-kb.xml" : "Custom.kb.xml"; + string file = Platform.IsMac? "Custom.mac-kb.xml" : "Custom.kb.xml"; return PropertyService.Locations.Config.Combine ("KeyBindings", file); } } @@ -109,12 +109,12 @@ namespace MonoDevelop.Components.Commands { if (args.Change == ExtensionChange.Add) { SchemeExtensionNode node = (SchemeExtensionNode) args.ExtensionNode; - if (node.IsForMac == PropertyService.IsMac) + if (node.IsForMac == Platform.IsMac) schemes.Add (node.Id, node); } else { SchemeExtensionNode node = (SchemeExtensionNode) args.ExtensionNode; - if (node.IsForMac == PropertyService.IsMac) + if (node.IsForMac == Platform.IsMac) schemes.Remove (node.Name); } } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockGrip.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockGrip.cs index 7f6e8b35ef..716763dee1 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockGrip.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockGrip.cs @@ -34,7 +34,7 @@ namespace MonoDevelop.Components.DockToolbars { internal class DockGrip: ToolItem { - static int GripSize = MonoDevelop.Core.PropertyService.IsWindows? 4 : 6; //wimp theme engine looks ugly with width 6 + static int GripSize = MonoDevelop.Core.Platform.IsWindows? 4 : 6; //wimp theme engine looks ugly with width 6 const int MarginLeft = 1; const int MarginRight = 3; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbar.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbar.cs index a06b337c38..281f3b65e3 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbar.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.DockToolbars/DockToolbar.cs @@ -274,7 +274,7 @@ namespace MonoDevelop.Components.DockToolbars // but only if horizontal, else the gradient usually looks really ugly if (this.Orientation == Orientation.Horizontal){ //the WIMP theme engine's rendering is a bit off, need to force it to render wider - int widen = MonoDevelop.Core.PropertyService.IsWindows? 1 : 0; + int widen = MonoDevelop.Core.Platform.IsWindows? 1 : 0; var shadowType = (ShadowType)StyleGetProperty ("shadow-type"); Style.PaintBox (Style, evnt.Window, State, shadowType, evnt.Area, this, "toolbar", diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/WindowCommands.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/WindowCommands.cs index 1899943150..c0e6e32844 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/WindowCommands.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Commands/WindowCommands.cs @@ -111,7 +111,7 @@ namespace MonoDevelop.Ide.Commands //Add AccelKey if (i < 10) { - commandInfo.AccelKey = ((PropertyService.IsMac) ? "Meta" : "Alt") + "|" + ((i + 1) % 10).ToString (); + commandInfo.AccelKey = ((Platform.IsMac) ? "Meta" : "Alt") + "|" + ((i + 1) % 10).ToString (); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs index f46541a115..e2b8e20731 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Components/ExtensibleTreeView.cs @@ -1898,7 +1898,7 @@ namespace MonoDevelop.Ide.Gui.Components protected override bool OnScrollEvent (Gdk.EventScroll evnt) { - var modifier = !PropertyService.IsMac? Gdk.ModifierType.ControlMask + var modifier = !Platform.IsMac? Gdk.ModifierType.ControlMask //Mac window manager already uses control-scroll, so use command //Command might be either meta or mod1, depending on GTK version : (Gdk.ModifierType.MetaMask | Gdk.ModifierType.Mod1Mask); diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MonoRuntimePanel.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MonoRuntimePanel.cs index aba80b9063..3af97d75cb 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MonoRuntimePanel.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.OptionPanels/MonoRuntimePanel.cs @@ -115,7 +115,7 @@ namespace MonoDevelop.Ide.Gui.OptionPanels }; //set a platform-dependent default folder for the dialog if possible - if (PropertyService.IsWindows) { + if (Platform.IsWindows) { string folder = Environment.GetFolderPath (Environment.SpecialFolder.ProgramFilesX86); if (!string.IsNullOrEmpty (folder) && System.IO.Directory.Exists (folder)) dlg.CurrentFolder = folder; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs index 526bfc4469..a63f466cff 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DefaultWorkbench.cs @@ -544,7 +544,7 @@ namespace MonoDevelop.Ide.Gui GetSize (out width, out height); // HACK: always capture bounds on OS X because we don't restore Gdk.WindowState.Maximized due to // the bug mentioned below. So we simular Maximized by capturing the Maximized size. - if (GdkWindow.State == 0 || PropertyService.IsMac) { + if (GdkWindow.State == 0 || Platform.IsMac) { memento.Bounds = new Rectangle (x, y, width, height); } else { memento.Bounds = normalBounds; @@ -566,7 +566,7 @@ namespace MonoDevelop.Ide.Gui // GdkWindow.State that means it doesn't reflect the real state, it only reflects values set // internally by GTK e.g. by Maximize calls. Because MD restores state, if it ever becomes // Maximized it becomes "stuck" and it's difficult for the user to make it "normal". - if (memento.WindowState == Gdk.WindowState.Maximized && !PropertyService.IsMac) { + if (memento.WindowState == Gdk.WindowState.Maximized && !Platform.IsMac) { Maximize (); } else if (memento.WindowState == Gdk.WindowState.Iconified) { Iconify (); @@ -851,7 +851,7 @@ namespace MonoDevelop.Ide.Gui fullViewVBox.PackEnd (this.StatusBar, false, true, 0); - if (MonoDevelop.Core.PropertyService.IsMac) + if (MonoDevelop.Core.Platform.IsMac) this.StatusBar.HasResizeGrip = true; else { if (GdkWindow != null && GdkWindow.State == Gdk.WindowState.Maximized) @@ -994,7 +994,7 @@ namespace MonoDevelop.Ide.Gui protected override bool OnKeyPressEvent (Gdk.EventKey evnt) { // Handle Alt+1-0 keys - Gdk.ModifierType winSwitchModifier = PropertyService.IsMac + Gdk.ModifierType winSwitchModifier = Platform.IsMac ? KeyBindingManager.SelectionModifierControl : KeyBindingManager.SelectionModifierAlt; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DragNotebook.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DragNotebook.cs index 75758e58a5..3b1cb8e493 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DragNotebook.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/DragNotebook.cs @@ -42,7 +42,7 @@ namespace MonoDevelop.Ide.Gui AddEvents ((Int32) (EventMask.AllEventsMask)); //FIXME: we make the tabs smaller by shrinking the border, but this looks ugly with the windows theme - if (!MonoDevelop.Core.PropertyService.IsWindows) + if (!MonoDevelop.Core.Platform.IsWindows) this.SetProperty ("tab-border", new GLib.Value (0)); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SyncContextAttribute.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SyncContextAttribute.cs index 49123167de..4d39beeaf3 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SyncContextAttribute.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/SyncContextAttribute.cs @@ -132,7 +132,7 @@ namespace MonoDevelop.Ide.Gui MethodBase GetRealMethod (IMethodMessage mm)
{
- if (PropertyService.IsWindows) { + if (Platform.IsWindows) { // HACK: When running on .NET, mm.MethodBase returns the method for the type of the proxy // instead of the target type. There is no legal way of getting the target type, so we have // to use reflection here.
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs index 79e4ace647..49c3031cbb 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs @@ -191,7 +191,7 @@ namespace MonoDevelop.Ide.Gui public void Present () { //FIXME: Present is broken on Mac GTK+. It maximises the window. - if (!PropertyService.IsMac) + if (!Platform.IsMac) RootWindow.Present (); } diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.OnlineTemplates/OnlineTemplateService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.OnlineTemplates/OnlineTemplateService.cs index 0301e9452b..7f2ef96539 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.OnlineTemplates/OnlineTemplateService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.OnlineTemplates/OnlineTemplateService.cs @@ -49,9 +49,9 @@ namespace MonoDevelop.Ide.OnlineTemplates internal static string GetOnlineTemplatesRoot () { string platform; - if (PropertyService.IsWindows) + if (Platform.IsWindows) platform = "win32"; - else if (PropertyService.IsMac) + else if (Platform.IsMac) platform = "mac"; else platform = "linux"; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/FeedbackService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/FeedbackService.cs index 4fef9214c4..d546a81541 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/FeedbackService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/FeedbackService.cs @@ -81,7 +81,7 @@ namespace MonoDevelop.Ide header += "Runtime: Microsoft .NET v" + Environment.Version + "\n"; } - string os = PropertyService.IsMac ? "Mac OSX" : (PropertyService.IsWindows ? "Windows" : "Linux"); + string os = Platform.IsMac ? "Mac OSX" : (Platform.IsWindows ? "Windows" : "Linux"); header += "Operating System: " + os + " (" + Environment.OSVersion + ")\n"; body = header + "\n" + body; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/HelpOperations.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/HelpOperations.cs index e2908e0852..9c2d6ed46a 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/HelpOperations.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/HelpOperations.cs @@ -52,7 +52,7 @@ namespace MonoDevelop.Ide if (topic == null || topic.Trim ().Length == 0) return; - if (PropertyService.IsMac) { + if (Platform.IsMac) { var url = "monodoc://" + System.Web.HttpUtility.UrlEncode (topic); string mdapp = new FilePath (typeof (HelpOperations).Assembly.Location) .ParentDirectory @@ -73,7 +73,7 @@ namespace MonoDevelop.Ide public bool CanShowHelp (string topic) { - return topic != null && !PropertyService.IsWindows; + return topic != null && !Platform.IsWindows; } void CheckExternalMonodoc () diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs index 177b06acd2..9a0bc6dc2f 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs @@ -128,7 +128,7 @@ namespace MonoDevelop.Ide //don't show the splash screen on the Mac, so instead we get the expected "Dock bounce" effect //this also enables the Mac platform service to subscribe to open document events before the GUI loop starts. - if (PropertyService.IsMac) + if (Platform.IsMac) options.NoLogo = true; IProgressMonitor monitor; diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs index 04af249384..fdef9835aa 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/MessageService.cs @@ -336,7 +336,7 @@ namespace MonoDevelop.Ide public static void PlaceDialog (Window child, Window parent) { //HACK: Mac GTK automatic window placement is broken - if (PropertyService.IsMac) + if (Platform.IsMac) CenterWindow (child, parent ?? GetDefaultParent (child)); } |