bool OpenFileInXcodeProject(string path)
        {
            bool succeeded = false;

            using (var monitor = GetStatusMonitor(GettextCatalog.GetString("Syncing to Xcode..."))) {
                try {
                    EnableSyncing();
                    if (!UpdateTypes(monitor, true) || monitor.IsCancelRequested)
                    {
                        return(succeeded);
                    }
                    if (!UpdateXcodeProject(monitor) || monitor.IsCancelRequested)
                    {
                        return(succeeded);
                    }
                    xcode.OpenFile(path);
                    succeeded = true;
                } catch (Exception ex) {
                    monitor.ReportError(GettextCatalog.GetString("Could not open file in Xcode project"), ex);
                } finally {
                    if (!succeeded)
                    {
                        DisableSyncing();
                    }
                }
            }
            return(succeeded);
        }
Example #2
0
        bool OpenFileInXcodeProject(IProgressMonitor monitor, string path)
        {
            bool succeeded = false;

            try {
                EnableSyncing(monitor);

                if (!UpdateTypes(monitor) || monitor.IsCancelRequested)
                {
                    return(false);
                }

                if (!UpdateXcodeProject(monitor) || monitor.IsCancelRequested)
                {
                    return(false);
                }

                xcode.OpenFile(monitor, path);
                succeeded = true;
            } catch (AppleScriptException asex) {
                ShowXcodeScriptError();
                monitor.ReportError(GettextCatalog.GetString("Could not open file in Xcode project."), asex);
            } catch (TimeoutException tex) {
                ShowXcodeScriptError();
                monitor.ReportError(GettextCatalog.GetString("Could not open file in Xcode project."), tex);
            } catch (Exception ex) {
                monitor.ReportError(GettextCatalog.GetString("Could not open file in Xcode project."), ex);
            } finally {
                if (!succeeded)
                {
                    DisableSyncing(true);
                }
            }

            return(succeeded);
        }