~bratsche/ubuntu/maverick/monodevelop/disable-appmenu

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/BreakpointPropertiesDialog.cs

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Ebner
  • Date: 2009-03-17 17:55:55 UTC
  • mfrom: (1.1.13 sid)
  • Revision ID: james.westby@ubuntu.com-20090317175555-2w5qbmu0l5maq6fq
Tags: 1.9.3+dfsg-1ubuntu1
* FFe for Monodevelop 2 granted by motu-release team :)
* Merge from Debian Unstable , remaining Ubuntu changes:
  + debian/control:
    - Update for Gnome# 2.24

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// BreakpointPropertiesDialog.cs
2
 
//
3
 
// Author:
4
 
//   Lluis Sanchez Gual <lluis@novell.com>
5
 
//
6
 
// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
7
 
//
8
 
// Permission is hereby granted, free of charge, to any person obtaining a copy
9
 
// of this software and associated documentation files (the "Software"), to deal
10
 
// in the Software without restriction, including without limitation the rights
11
 
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
 
// copies of the Software, and to permit persons to whom the Software is
13
 
// furnished to do so, subject to the following conditions:
14
 
//
15
 
// The above copyright notice and this permission notice shall be included in
16
 
// all copies or substantial portions of the Software.
17
 
//
18
 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
 
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
 
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
 
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
 
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
 
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
 
// THE SOFTWARE.
25
 
//
26
 
//
27
 
 
28
 
using System;
29
 
using MonoDevelop.Core.Gui;
30
 
using MonoDevelop.Core;
31
 
using Mono.Debugging.Client;
32
 
 
33
 
namespace MonoDevelop.Ide.Gui.Dialogs
34
 
{
35
 
        public partial class BreakpointPropertiesDialog : Gtk.Dialog
36
 
        {
37
 
                Breakpoint bp;
38
 
                
39
 
                public BreakpointPropertiesDialog (Breakpoint bp, bool isNew)
40
 
                {
41
 
                        this.Build();
42
 
                        this.bp = bp;
43
 
                        
44
 
                        entryFile.Text = bp.FileName;
45
 
                        entryLine.Text = bp.Line.ToString ();
46
 
                        
47
 
                        if (!isNew) {
48
 
                                entryFile.IsEditable = false;
49
 
                                entryLine.IsEditable = false;
50
 
                                entryFile.ModifyBase (Gtk.StateType.Normal, Style.Backgrounds [(int)Gtk.StateType.Insensitive]);
51
 
                                entryFile.ModifyBase (Gtk.StateType.Active, Style.Backgrounds [(int)Gtk.StateType.Insensitive]);
52
 
                                entryLine.ModifyBase (Gtk.StateType.Normal, Style.Backgrounds [(int)Gtk.StateType.Insensitive]);
53
 
                                entryLine.ModifyBase (Gtk.StateType.Active, Style.Backgrounds [(int)Gtk.StateType.Insensitive]);
54
 
                        }
55
 
                        
56
 
                        if (string.IsNullOrEmpty (bp.ConditionExpression)) {
57
 
                                radioBreakAlways.Active = true;
58
 
                        } else {
59
 
                                entryCondition.Text = bp.ConditionExpression;
60
 
                                if (bp.BreakIfConditionChanges)
61
 
                                        radioBreakChange.Active = true;
62
 
                                else
63
 
                                        radioBreakTrue.Active = true;
64
 
                        }
65
 
                        
66
 
                        spinHitCount.Value = bp.HitCount;
67
 
                        
68
 
                        if (bp.HitAction == HitAction.Break)
69
 
                                radioActionBreak.Active = true;
70
 
                        else {
71
 
                                radioActionTrace.Active = true;
72
 
                                entryTraceExpr.Text = bp.TraceExpression;
73
 
                        }
74
 
                        
75
 
                        UpdateControls ();
76
 
                }
77
 
                
78
 
                void UpdateControls ()
79
 
                {
80
 
                        boxTraceExpression.Sensitive = radioActionTrace.Active;
81
 
                        boxCondition.Sensitive = !radioBreakAlways.Active;
82
 
                }
83
 
                
84
 
                public bool Check ()
85
 
                {
86
 
                        if (!radioBreakAlways.Active && entryCondition.Text.Length == 0) {
87
 
                                MessageService.ShowError (GettextCatalog.GetString ("Condition expression not specified"));
88
 
                                return false;
89
 
                        }
90
 
                        if (radioActionTrace.Active && entryTraceExpr.Text.Length == 0) {
91
 
                                MessageService.ShowError (GettextCatalog.GetString ("Trace expression not specified"));
92
 
                                return false;
93
 
                        }
94
 
                        return true;
95
 
                }
96
 
                
97
 
                public void Save ()
98
 
                {
99
 
                        if (!radioBreakAlways.Active) {
100
 
                                bp.ConditionExpression = entryCondition.Text;
101
 
                                bp.BreakIfConditionChanges = radioBreakChange.Active;
102
 
                        } else
103
 
                                bp.ConditionExpression = null;
104
 
                        
105
 
                        bp.HitCount = (int) spinHitCount.Value;
106
 
                        
107
 
                        if (radioActionBreak.Active)
108
 
                                bp.HitAction = HitAction.Break;
109
 
                        else {
110
 
                                bp.HitAction = HitAction.PrintExpression;
111
 
                                bp.TraceExpression = entryTraceExpr.Text;
112
 
                        }
113
 
                        bp.CommitChanges ();
114
 
                }
115
 
 
116
 
                protected virtual void OnButtonOkClicked (object sender, System.EventArgs e)
117
 
                {
118
 
                        if (Check ()) {
119
 
                                Save ();
120
 
                                Respond (Gtk.ResponseType.Ok);
121
 
                        }
122
 
                }
123
 
 
124
 
                protected virtual void OnRadioBreakAlwaysToggled (object sender, System.EventArgs e)
125
 
                {
126
 
                        UpdateControls ();
127
 
                }
128
 
 
129
 
                protected virtual void OnRadioActionBreakToggled (object sender, System.EventArgs e)
130
 
                {
131
 
                        UpdateControls ();
132
 
                }
133
 
        }
134
 
}