~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ImmediatePad.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
        public class ImmediatePad: IPadContent
38
38
        {
39
39
                ConsoleView view;
 
40
                bool disposed;
40
41
                
41
42
                public void Initialize (IPadWindow container)
42
43
                {
43
44
                        view = new ConsoleView ();
44
45
                        view.ConsoleInput += OnViewConsoleInput;
45
 
                        Pango.FontDescription font = Pango.FontDescription.FromString (DesktopService.DefaultMonospaceFont);
46
 
                        font.Size = (font.Size * 8) / 10;
47
 
                        view.SetFont (font);
 
46
                        view.SetFont (IdeApp.Preferences.CustomOutputPadFont);
48
47
                        view.ShadowType = Gtk.ShadowType.None;
49
48
                        view.ShowAll ();
 
49
 
 
50
                        IdeApp.Preferences.CustomOutputPadFontChanged += HandleCustomOutputPadFontChanged;
 
51
                }
 
52
 
 
53
                void HandleCustomOutputPadFontChanged (object sender, EventArgs e)
 
54
                {
 
55
                        view.SetFont (IdeApp.Preferences.CustomOutputPadFont);
50
56
                }
51
57
 
52
58
                void OnViewConsoleInput (object sender, ConsoleInputEventArgs e)
57
63
                                view.WriteOutput ("The expression can't be evaluated while the application is running.");
58
64
                        } else {
59
65
                                EvaluationOptions ops = EvaluationOptions.DefaultOptions;
 
66
                                var frame = DebuggingService.CurrentFrame;
 
67
                                string expression = e.Text;
 
68
 
60
69
                                ops.AllowMethodEvaluation = true;
61
70
                                ops.AllowToStringCalls = true;
62
71
                                ops.AllowTargetInvoke = true;
63
72
                                ops.EvaluationTimeout = 20000;
64
73
                                ops.EllipsizeStrings = false;
65
 
                                var ff = DebuggingService.CurrentFrame;
66
 
                                string tt = e.Text;
67
 
                                ValidationResult vres = ff.ValidateExpression (tt, ops);
 
74
 
 
75
                                var vres = frame.ValidateExpression (expression, ops);
68
76
                                if (!vres) {
69
77
                                        view.WriteOutput (vres.Message);
70
78
                                        view.Prompt (true);
71
79
                                        return;
72
80
                                }
73
 
                                ObjectValue val = DebuggingService.CurrentFrame.GetExpressionValue (e.Text, ops);
 
81
 
 
82
                                var val = frame.GetExpressionValue (expression, ops);
74
83
                                if (val.IsEvaluating) {
75
84
                                        WaitForCompleted (val);
76
85
                                        return;
77
86
                                }
 
87
 
78
88
                                PrintValue (val);
79
89
                        }
80
90
                        view.Prompt (true);
131
141
                
132
142
                public void Dispose ()
133
143
                {
 
144
                        if (!disposed) {
 
145
                                IdeApp.Preferences.CustomOutputPadFontChanged -= HandleCustomOutputPadFontChanged;
 
146
                                disposed = true;
 
147
                        }
134
148
                }
135
149
        }
136
150
}