public IgnoreExceptionController()
            : base(NSObject.AllocAndInitInstance("IgnoreExceptionController"))
        {
            Unused.Value = NSBundle.loadNibNamed_owner(NSString.Create("ignore-exception"), this);

            Boss boss = ObjectModel.Create("Application");
            var exceptions = boss.Get<IExceptions>();

            m_text = new IBOutlet<NSTextView>(this, "text").Value;
            m_text.insertText(NSString.Create(string.Join("\n", exceptions.Ignored)));
            window().makeKeyAndOrderFront(this);
        }
Exemplo n.º 2
0
        public bool HandleKey(NSTextView view, NSEvent evt)
        {
            bool handled = false;

            try
            {
                if (m_database != null)
                {
                    NSRange range = view.selectedRange();

                    NSString chars = evt.characters();
                    if (range.length == 0 && chars.length() == 1 && chars[0] == '.')
                    {
                        view.insertText(NSString.Create('.'));
                        Unused.Value = DoComplete(this.DoCompleteDot, view, range);
                        handled = true;
                    }
                    else if (range.length == 0 && chars.length() == 1 && chars[0] == '\t')
                    {
                        handled = DoCompleteTab(view, evt, range);
                    }

                    if (!handled)
                    {
                        var annotation = m_boss.Get<IArgsAnnotation>();
                        handled = annotation.HandleKey(view, evt);
                    }
                }
            }
            catch (Exception e)
            {
                Log.WriteLine(TraceLevel.Error, "Errors", "Autocomplete failed:");
                Log.WriteLine(TraceLevel.Error, "Errors", e.ToString());

                NSString title = NSString.Create("Auto-complete failed.");
                NSString message = NSString.Create(e.Message);
                Unused.Value = Functions.NSRunAlertPanel(title, message);
            }

            return handled;
        }