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

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/WatchPad.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:
1
1
// WatchPad.cs
2
2
//
3
 
// Author:
4
 
//   Lluis Sanchez Gual <lluis@novell.com>
 
3
// Authors: Lluis Sanchez Gual <lluis@novell.com>
 
4
//          Jeffrey Stedfast <jeff@xamarin.com>
5
5
//
6
6
// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
 
7
// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
7
8
//
8
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
9
10
// of this software and associated documentation files (the "Software"), to deal
25
26
//
26
27
//
27
28
 
 
29
using System;
28
30
using System.Xml;
29
31
using System.Collections.Generic;
 
32
 
30
33
using MonoDevelop.Core;
31
34
using MonoDevelop.Ide.Gui;
32
35
 
33
36
namespace MonoDevelop.Debugger
34
37
{
35
 
        public class WatchPad: ObjectValuePad, IMementoCapable, ICustomXmlSerializer
 
38
        public class WatchPad : ObjectValuePad, IMementoCapable, ICustomXmlSerializer
36
39
        {
 
40
                static Gtk.TargetEntry[] DropTargets = new Gtk.TargetEntry[] {
 
41
                        new Gtk.TargetEntry ("text/plain;charset=utf-8", Gtk.TargetFlags.App, 0)
 
42
                };
37
43
                List<string> storedVars;
38
44
                
39
 
                public WatchPad()
 
45
                public WatchPad ()
40
46
                {
 
47
                        tree.EnableModelDragDest (DropTargets, Gdk.DragAction.Copy);
 
48
                        tree.DragDataReceived += HandleDragDataReceived;
41
49
                        tree.AllowAdding = true;
42
50
                }
 
51
 
 
52
                void HandleDragDataReceived (object o, Gtk.DragDataReceivedArgs args)
 
53
                {
 
54
                        var text = args.SelectionData.Text;
 
55
 
 
56
                        args.RetVal = true;
 
57
 
 
58
                        if (string.IsNullOrEmpty (text))
 
59
                                return;
 
60
 
 
61
                        foreach (var expr in text.Split (new char[] { '\n' })) {
 
62
                                if (string.IsNullOrWhiteSpace (expr))
 
63
                                        continue;
 
64
 
 
65
                                AddWatch (expr.Trim ());
 
66
                        }
 
67
                }
43
68
                
44
69
                public void AddWatch (string expression)
45
70
                {
46
71
                        tree.AddExpression (expression);
47
72
                }
 
73
 
 
74
                protected override void OnDebuggerStopped (object s, EventArgs a)
 
75
                {
 
76
                        base.OnDebuggerStopped (s, a);
 
77
                        tree.Sensitive = true;
 
78
                }
48
79
                
49
80
                #region IMementoCapable implementation 
50
81
                
61
92
                        }
62
93
                }
63
94
                
64
 
                void ICustomXmlSerializer.WriteTo (System.Xml.XmlWriter writer)
 
95
                void ICustomXmlSerializer.WriteTo (XmlWriter writer)
65
96
                {
66
97
                        if (tree != null) {
67
98
                                writer.WriteStartElement ("Values");
71
102
                        }
72
103
                }
73
104
                
74
 
                ICustomXmlSerializer ICustomXmlSerializer.ReadFrom (System.Xml.XmlReader reader)
 
105
                ICustomXmlSerializer ICustomXmlSerializer.ReadFrom (XmlReader reader)
75
106
                {
76
107
                        storedVars = new List<string> ();
77
108