diff options
author | Alan McGovern <alan.mcgovern@gmail.com> | 2011-11-28 18:11:40 +0400 |
---|---|---|
committer | Alan McGovern <alan.mcgovern@gmail.com> | 2011-11-29 15:13:31 +0400 |
commit | f3f939700eb1fc8ea5b4a26ddd609a9e586e7b4d (patch) | |
tree | b8d110ac1d21d94c71d040c4f8d71b5b81760606 /main/src | |
parent | c22099de8965697c4b2d44425a1d2b25a90249aa (diff) |
[MacDev] Show an error if xcode 4.2 is not installed
Fixes bug #1138. The user will be given a proper error message if they
try to open a storyboard file or xib without installing xcode.
Diffstat (limited to 'main/src')
3 files changed, 28 insertions, 20 deletions
diff --git a/main/src/addins/MonoDevelop.MacDev/AppleSdkSettings.cs b/main/src/addins/MonoDevelop.MacDev/AppleSdkSettings.cs index 6a116f403a..298a1c34ff 100644 --- a/main/src/addins/MonoDevelop.MacDev/AppleSdkSettings.cs +++ b/main/src/addins/MonoDevelop.MacDev/AppleSdkSettings.cs @@ -107,6 +107,7 @@ namespace MonoDevelop.MacDev DTXcode = ((NSString) value).ToString (); } IsXcode4 = !string.IsNullOrEmpty (DTXcode) && int.Parse (DTXcode) >= 0400; + IsXcode42 = !string.IsNullOrEmpty (DTXcode) && int.Parse (DTXcode) >= 0420; IsValid = true; } catch (Exception ex) { LoggingService.LogError ("Error loading Xcode information for prefix '" + DeveloperRoot + "'", ex); @@ -137,6 +138,7 @@ namespace MonoDevelop.MacDev public static bool IsValid { get; private set; } public static string DTXcode { get; private set; } public static bool IsXcode4 { get; private set; } + public static bool IsXcode42 { get; private set; } public static event Action Changed; } diff --git a/main/src/addins/MonoDevelop.MacDev/XcodeInterfaceBuilderDisplayBinding.cs b/main/src/addins/MonoDevelop.MacDev/XcodeInterfaceBuilderDisplayBinding.cs index 3f2685ce5a..0eef51b439 100644 --- a/main/src/addins/MonoDevelop.MacDev/XcodeInterfaceBuilderDisplayBinding.cs +++ b/main/src/addins/MonoDevelop.MacDev/XcodeInterfaceBuilderDisplayBinding.cs @@ -69,6 +69,9 @@ namespace MonoDevelop.MacDev public override void Launch (params string[] files) { + if (!AppleSdkSettings.IsXcode42) + throw new UserException ("XCode 4.2 is required to open file {0}", files [0]); + project.XcodeProjectTracker.OpenDocument (files[0]); } } 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 91b9da9aaa..e9bbf2517b 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Workbench.cs @@ -747,27 +747,30 @@ namespace MonoDevelop.Ide.Gui viewBinding = binding as IViewDisplayBinding; } } - - if (binding != null) { - if (viewBinding != null) { - var fw = new LoadFileWrapper (workbench, viewBinding, project, openFileInfo); - fw.Invoke (fileName); - } else { - var extBinding = (IExternalDisplayBinding)binding; - var app = extBinding.GetApplication (fileName, null, project); - app.Launch (fileName); - } - - Counters.OpenDocumentTimer.Trace ("Adding to recent files"); - DesktopService.RecentFiles.AddFile (fileName, project); - } else if (!openFileInfo.Options.HasFlag (OpenDocumentOptions.OnlyInternalViewer)) { - try { - Counters.OpenDocumentTimer.Trace ("Showing in browser"); - DesktopService.OpenFile (fileName); - } catch (Exception ex) { - LoggingService.LogError ("Error opening file: " + fileName, ex); - MessageService.ShowError (GettextCatalog.GetString ("File '{0}' could not be opened", fileName)); + try { + if (binding != null) { + if (viewBinding != null) { + var fw = new LoadFileWrapper (workbench, viewBinding, project, openFileInfo); + fw.Invoke (fileName); + } else { + var extBinding = (IExternalDisplayBinding)binding; + var app = extBinding.GetApplication (fileName, null, project); + app.Launch (fileName); + } + + Counters.OpenDocumentTimer.Trace ("Adding to recent files"); + DesktopService.RecentFiles.AddFile (fileName, project); + } else if (!openFileInfo.Options.HasFlag (OpenDocumentOptions.OnlyInternalViewer)) { + try { + Counters.OpenDocumentTimer.Trace ("Showing in browser"); + DesktopService.OpenFile (fileName); + } catch (Exception ex) { + LoggingService.LogError ("Error opening file: " + fileName, ex); + MessageService.ShowError (GettextCatalog.GetString ("File '{0}' could not be opened", fileName)); + } } + } catch (Exception ex) { + monitor.ReportError ("", ex); } } } |