| Newsgroups |
gmane.comp.gnome.mono.patches |
| Message-ID |
<00000141d0246a24-409e1894-5b17-4eed-ac88-870b34b4db0a-000000@email.amazonses.com> |
Branch: refs/heads/bpDialog2
Home: https://github.com/mono/monodevelop
Compare: https://github.com/mono/monodevelop/compare/ac62cdcaaa50...3219ddab2af1
Commit: ee6f869674638fbfed409718df6496fb5ba909ef
Author: Therzok <[email protected]> (Therzok)
Committer: Ungureanu Marius <[email protected]> (Therzok)
Date: 2013-10-19 09:51:34 GMT
URL: https://github.com/mono/monodevelop/commit/ee6f869674638fbfed409718df6496fb5ba909ef
[Debugger] New Dialog.
Changed paths:
M main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml
M main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj
M main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs
M main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
M main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
Added paths:
A main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog2.cs
Modified: main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml
===================================================================
@@ -117,10 +117,6 @@
defaultHandler = "MonoDevelop.Debugger.NewBreakpointHandler"
_label = "New Breakpoint..."
icon = "md-breakpoint-new" />
- <Command id = "MonoDevelop.Debugger.DebugCommands.NewFunctionBreakpoint"
- defaultHandler = "MonoDevelop.Debugger.NewFunctionBreakpointHandler"
- _label = "New Function Breakpoint..."
- icon = "md-breakpoint-new" />
<Command id = "MonoDevelop.Debugger.DebugCommands.RemoveBreakpoint"
defaultHandler = "MonoDevelop.Debugger.RemoveBreakpointHandler"
_label = "Remove Breakpoint" />
@@ -193,7 +189,6 @@
<CommandItem id = "MonoDevelop.Debugger.DebugCommands.StepOut" />
<CommandItem id = "MonoDevelop.Debugger.DebugCommands.ShowCurrentExecutionLine" />
<SeparatorItem id = "MonoDevelop.Debugger.BreakpointsSection" />
- <CommandItem id = "MonoDevelop.Debugger.DebugCommands.NewFunctionBreakpoint" />
<CommandItem id = "MonoDevelop.Debugger.DebugCommands.NewBreakpoint" />
<CommandItem id = "MonoDevelop.Debugger.DebugCommands.ToggleBreakpoint" />
<CommandItem id = "MonoDevelop.Debugger.DebugCommands.AddTracepoint" />
Modified: main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj
===================================================================
@@ -22,8 +22,8 @@
<Execution>
<Execution clr-version="Net_2_0" />
</Execution>
- <GenerateDocumentation>true</GenerateDocumentation>
<NoWarn>1591;1573</NoWarn>
+ <DocumentationFile>..\..\..\build\AddIns\MonoDevelop.Debugger\MonoDevelop.Debugger.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -36,8 +36,8 @@
<Execution clr-version="Net_2_0" />
</Execution>
<DebugSymbols>true</DebugSymbols>
- <GenerateDocumentation>true</GenerateDocumentation>
<NoWarn>1591;1573</NoWarn>
+ <DocumentationFile>..\..\..\build\AddIns\MonoDevelop.Debugger\MonoDevelop.Debugger.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@@ -149,6 +149,7 @@
<Compile Include="MonoDevelop.Debugger\DebuggerConsoleView.cs" />
<Compile Include="MonoDevelop.Debugger.Visualizer\CStringVisualizer.cs" />
<Compile Include="MonoDevelop.Debugger.Visualizer\ValueVisualizer.cs" />
+ <Compile Include="MonoDevelop.Debugger\BreakpointPropertiesDialog2.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MonoDevelop.Debugger.addin.xml">
Modified: main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs
===================================================================
@@ -204,8 +204,8 @@ protected void OnProperties ()
TreeIter iter;
if (selected.Length == 1 && store.GetIter (out iter, selected[0])) {
- Breakpoint bp = (Breakpoint) store.GetValue (iter, (int) Columns.Breakpoint);
- if (DebuggingService.ShowBreakpointProperties (bp, false))
+ BreakEvent bp = (BreakEvent) store.GetValue (iter, (int) Columns.Breakpoint);
+ if (DebuggingService.ShowBreakpointProperties (ref bp))
UpdateDisplay ();
}
}
Added: main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog2.cs
===================================================================
@@ -0,0 +1,502 @@
+//
+// BreakpointsPropertiesDialog.cs
+//
+// Author:
+// Therzok <[email protected]>
+//
+// Copyright (c) 2013 Therzok
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using Mono.Debugging.Client;
+using MonoDevelop.Core;
+using MonoDevelop.Projects;
+using MonoDevelop.Ide;
+
+namespace MonoDevelop.Debugger
+{
+ enum ConditionalHitWhen {
+ ConditionIsTrue,
+ ExpressionChanges
+ }
+
+ class BreakpointPropertiesDialog2 : Xwt.Dialog
+ {
+ // For button sensitivity.
+ Xwt.DialogButton buttonOk;
+
+ // Groupings for sensitivity
+ Xwt.HBox hboxFunction = new Xwt.HBox ();
+ Xwt.HBox hboxLocation = new Xwt.HBox ();
+ Xwt.HBox hboxLineColumn = new Xwt.HBox ();
+ Xwt.HBox hboxException = new Xwt.HBox ();
+
+ // Stop-type radios.
+ readonly Xwt.RadioButton stopOnFunction = new Xwt.RadioButton (GettextCatalog.GetString ("When a function is entered"));
+ readonly Xwt.RadioButton stopOnLocation = new Xwt.RadioButton (GettextCatalog.GetString ("When a location is reached"));
+ readonly Xwt.RadioButton stopOnException = new Xwt.RadioButton (GettextCatalog.GetString ("When an exception is thrown"));
+
+ // Text entries
+ readonly Xwt.TextEntry entryFunctionName = new Xwt.TextEntry ();
+ readonly Xwt.TextEntry entryLocationFile = new Xwt.TextEntry ();
+ readonly Xwt.TextEntry entryLocationLine = new Xwt.TextEntry ();
+ readonly Xwt.TextEntry entryLocationColumn = new Xwt.TextEntry ();
+ readonly Xwt.TextEntry entryExceptionType = new Xwt.TextEntry ();
+ readonly Xwt.TextEntry entryConditionalExpression = new Xwt.TextEntry ();
+ readonly Xwt.TextEntry entryPrintExpression = new Xwt.TextEntry ();
+
+ // Warning icon
+ readonly Xwt.ImageView warningFunction = new Xwt.ImageView (Xwt.StockIcons.Warning);
+ readonly Xwt.ImageView warningLocation = new Xwt.ImageView (Xwt.StockIcons.Warning);
+ readonly Xwt.ImageView warningException = new Xwt.ImageView (Xwt.StockIcons.Warning);
+ readonly Xwt.ImageView warningCondition = new Xwt.ImageView (Xwt.StockIcons.Warning);
+
+ // Combobox + Pager
+ readonly Xwt.SpinButton ignoreHitCount = new Xwt.SpinButton ();
+ readonly Xwt.ComboBox ignoreHitType = new Xwt.ComboBox ();
+ readonly Xwt.ComboBox conditionalHitType = new Xwt.ComboBox ();
+
+ // Optional checkboxes.
+ readonly Xwt.CheckBox checkIncludeSubclass = new Xwt.CheckBox (GettextCatalog.GetString ("Include subclasses"));
+ readonly Xwt.CheckBox checkPrintExpression = new Xwt.CheckBox (GettextCatalog.GetString ("Print an expression to the debugger output"));
+ readonly Xwt.CheckBox checkResumeExecution = new Xwt.CheckBox (GettextCatalog.GetString ("Resume execution automatically"));
+
+ BreakEvent be;
+ string[] parsedParamTypes;
+ string parsedFunction;
+
+ public BreakpointPropertiesDialog2 (ref BreakEvent be)
+ {
+ this.be = be;
+
+ Initialize ();
+ SetInitialData ();
+ SetLayout ();
+ }
+
+ void Initialize ()
+ {
+ // TODO: Make dialog for exceptions.
+ Title = GettextCatalog.GetString (be == null ? "New Breakpoint" : "Breakpoint Properties");
+ var buttonLabel = GettextCatalog.GetString (be == null ? "Add breakpoint" : "Modify breakpoint");
+
+ var stopGroup = new Xwt.RadioButtonGroup ();
+ stopOnFunction.Group = stopGroup;
+ stopOnLocation.Group = stopGroup;
+ stopOnException.Group = stopGroup;
+
+ ignoreHitType.Items.Add (HitCountMode.None, GettextCatalog.GetString ("always"));
+ ignoreHitType.Items.Add (HitCountMode.LessThan, GettextCatalog.GetString ("when hit count is less than"));
+ ignoreHitType.Items.Add (HitCountMode.LessThanOrEqualTo, GettextCatalog.GetString ("when hit count is less than or equal to"));
+ ignoreHitType.Items.Add (HitCountMode.EqualTo, GettextCatalog.GetString ("when hit count is equal to"));
+ ignoreHitType.Items.Add (HitCountMode.GreaterThan, GettextCatalog.GetString ("when hit count is greater than"));
+ ignoreHitType.Items.Add (HitCountMode.GreaterThanOrEqualTo, GettextCatalog.GetString ("when hit count is greater than or equal to"));
+ ignoreHitType.Items.Add (HitCountMode.MultipleOf, GettextCatalog.GetString ("when hit count is a multiple of"));
+
+ ignoreHitCount.IncrementValue = 1;
+
+ conditionalHitType.Items.Add (ConditionalHitWhen.ConditionIsTrue, GettextCatalog.GetString ("is true"));
+ conditionalHitType.Items.Add (ConditionalHitWhen.ExpressionChanges, GettextCatalog.GetString ("expression changes"));
+
+ buttonOk = new Xwt.DialogButton (buttonLabel, Xwt.Command.Ok) {
+ Sensitive = false
+ };
+
+ // Register events.
+ stopGroup.ActiveRadioButtonChanged += OnUpdateControls;
+ entryFunctionName.Changed += OnUpdateControls;
+ entryLocationFile.Changed += OnUpdateControls;
+ entryLocationLine.Changed += OnUpdateControls;
+ entryLocationColumn.Changed += OnUpdateControls;
+
+ entryConditionalExpression.Changed += OnUpdateControls;
+ ignoreHitType.SelectionChanged += OnUpdateControls;
+ checkPrintExpression.Toggled += OnUpdateControls;
+
+ buttonOk.Clicked += OnSave;
+ }
+
+ void SetInitialFunctionBreakpointData (FunctionBreakpoint fb)
+ {
+ stopOnFunction.Active = true;
+ if (fb.ParamTypes != null) {
+ // FIXME: support non-C# syntax based on fb.Language
+ entryFunctionName.Text = fb.FunctionName + " (" + String.Join (", ", fb.ParamTypes) + ")";
+ } else
+ entryFunctionName.Text = fb.FunctionName;
+ }
+
+ void SetInitialBreakpointData (Breakpoint bp)
+ {
+ stopOnLocation.Active = true;
+ entryLocationFile.Text = bp.FileName;
+ entryLocationLine.Text = bp.Line.ToString ();
+ entryLocationColumn.Text = bp.Column.ToString ();
+
+ if (!String.IsNullOrEmpty (bp.ConditionExpression)) {
+ entryConditionalExpression.Text = bp.ConditionExpression;
+ conditionalHitType.SelectedItem = bp.BreakIfConditionChanges ? ConditionalHitWhen.ExpressionChanges : ConditionalHitWhen.ConditionIsTrue;
+ }
+
+ Project project = null;
+ if (!String.IsNullOrEmpty (bp.FileName))
+ project = IdeApp.Workspace.GetProjectContainingFile (bp.FileName);
+
+ if (project != null) {
+ // Check the startup project of the solution too, since the current project may be a library
+ SolutionEntityItem startup = project.ParentSolution.StartupItem;
+ entryConditionalExpression.Sensitive = DebuggingService.IsFeatureSupported (project, DebuggerFeatures.ConditionalBreakpoints) ||
+ DebuggingService.IsFeatureSupported (startup, DebuggerFeatures.ConditionalBreakpoints);
+
+ bool canTrace = DebuggingService.IsFeatureSupported (project, DebuggerFeatures.Tracepoints) ||
+ DebuggingService.IsFeatureSupported (startup, DebuggerFeatures.Tracepoints);
+
+ checkPrintExpression.Sensitive = canTrace;
+ entryPrintExpression.Sensitive = canTrace;
+ }
+ }
+
+ void SetInitialCatchpointData (Catchpoint cp)
+ {
+
+ }
+
+ void SetInitialData ()
+ {
+ if (be != null) {
+ stopOnException.Sensitive = false;
+ stopOnFunction.Sensitive = false;
+ stopOnLocation.Sensitive = false;
+ entryLocationFile.ReadOnly = true;
+ entryLocationLine.ReadOnly = true;
+ entryLocationColumn.ReadOnly = true;
+
+ ignoreHitType.SelectedItem = be.HitCountMode;
+ ignoreHitCount.Value = be.HitCount;
+
+ if (be.HitAction == HitAction.PrintExpression) {
+ checkPrintExpression.Active = true;
+ entryPrintExpression.Text = be.TraceExpression;
+ }
+ } else {
+ if (IdeApp.Workbench.ActiveDocument != null) {
+ entryLocationFile.Text = IdeApp.Workbench.ActiveDocument.FileName;
+ entryLocationLine.Text = IdeApp.Workbench.ActiveDocument.Editor.Caret.Line.ToString ();
+ entryLocationColumn.Text = IdeApp.Workbench.ActiveDocument.Editor.Caret.Column.ToString ();
+ }
+
+ ignoreHitType.SelectedItem = HitCountMode.None;
+ conditionalHitType.SelectedItem = ConditionalHitWhen.ConditionIsTrue;
+ }
+
+ var fb = be as FunctionBreakpoint;
+ if (fb != null)
+ SetInitialFunctionBreakpointData (fb);
+
+ var bp = be as Breakpoint;
+ if (bp != null)
+ SetInitialBreakpointData (bp);
+
+ var cp = be as Catchpoint;
+ if (cp != null)
+ SetInitialCatchpointData (cp);
+ }
+
+ void SaveFunctionBreakpoint (FunctionBreakpoint fb, bool isNew)
+ {
+ if (isNew) {
+ fb.FunctionName = parsedFunction;
+ fb.ParamTypes = parsedParamTypes;
+ }
+ }
+
+ void SaveBreakpoint (Breakpoint bp, bool isNew)
+ {
+ if (isNew) {
+ bp.SetColumn (Int32.Parse (entryLocationColumn.Text));
+ bp.SetLine (Int32.Parse (entryLocationLine.Text));
+ }
+
+ if (!String.IsNullOrEmpty (entryConditionalExpression.Text)) {
+ bp.ConditionExpression = entryConditionalExpression.Text;
+ bp.BreakIfConditionChanges = conditionalHitType.SelectedItem.Equals (ConditionalHitWhen.ExpressionChanges);
+ } else
+ bp.ConditionExpression = null;
+ }
+
+ void SaveCatchpoint (Catchpoint cp, bool isNew)
+ {
+
+ }
+
+ void OnSave (object sender, EventArgs e)
+ {
+ bool isNew = false;
+ if (be == null) {
+ isNew = true;
+
+ if (stopOnFunction.Active)
+ be = new FunctionBreakpoint ("", "C#");
+ else if (stopOnLocation.Active)
+ be = new Breakpoint (entryLocationFile.Text, Int32.Parse (entryLocationLine.Text), Int32.Parse (entryLocationColumn.Text));
+ else if (stopOnException.Active)
+ be = new Catchpoint (entryExceptionType.Text);
+ else
+ return;
+ }
+
+ var fb = be as FunctionBreakpoint;
+ if (fb != null)
+ SaveFunctionBreakpoint (fb, isNew);
+
+ var bp = be as Breakpoint;
+ if (bp != null)
+ SaveBreakpoint (bp, isNew);
+
+ var cp = be as Catchpoint;
+ if (cp != null)
+ SaveCatchpoint (cp, isNew);
+
+ be.HitCountMode = (HitCountMode)ignoreHitType.SelectedItem;
+ be.HitCount = be.HitCountMode != HitCountMode.None ? (int)ignoreHitCount.Value : 0;
+
+ if (checkPrintExpression.Active) {
+ // FIXME: Make HitAction flags.
+ be.HitAction = HitAction.PrintExpression;
+ be.TraceExpression = entryPrintExpression.Text;
+ }
+ be.HitAction = HitAction.Break;
+
+ be.CommitChanges ();
+ }
+
+ void OnUpdateControls (object sender, EventArgs e)
+ {
+ // Check which radio is selected.
+ hboxFunction.Sensitive = stopOnFunction.Active;
+ hboxLineColumn.Sensitive = stopOnLocation.Active;
+ hboxLocation.Sensitive = stopOnLocation.Active;
+ hboxException.Sensitive = stopOnException.Active;
+ checkIncludeSubclass.Sensitive = stopOnException.Active;
+
+ // Check conditional
+ if (!String.IsNullOrEmpty (entryConditionalExpression.Text))
+ conditionalHitType.Show ();
+ else
+ conditionalHitType.Hide ();
+
+ // Check ignoring hit counts.
+ if (ignoreHitType.SelectedItem.Equals (HitCountMode.None))
+ ignoreHitCount.Hide ();
+ else
+ ignoreHitCount.Show ();
+
+ // Check printing an expression.
+ entryPrintExpression.Sensitive = checkPrintExpression.Active;
+ checkResumeExecution.Sensitive = checkPrintExpression.Active;
+
+ // And display warning icons
+ buttonOk.Sensitive = CheckValidity ();
+ }
+
+ bool CheckValidity ()
+ {
+ if (be is FunctionBreakpoint) {
+ string text = entryFunctionName.Text.Trim ();
+
+ if (stopOnFunction.Active) {
+ if (text.Length == 0) {
+ warningFunction.Show ();
+ warningFunction.TooltipText = GettextCatalog.GetString ("Function name not specified");
+ return false;
+ }
+
+ if (!TryParseFunction (text, out parsedFunction, out parsedParamTypes)) {
+ warningFunction.Show ();
+ warningFunction.TooltipText = GettextCatalog.GetString ("Invalid function syntax");
+ return false;
+ }
+ }
+ } else if (be is Breakpoint) {
+ if (!System.IO.File.Exists (entryLocationFile.Text)) {
+ warningLocation.Show ();
+ warningLocation.TooltipText = GettextCatalog.GetString ("File does not exist");
+ return false;
+ }
+
+ int val;
+ if (!Int32.TryParse (entryLocationLine.Text, out val)) {
+ warningLocation.Show ();
+ warningLocation.TooltipText = GettextCatalog.GetString ("Line is not a number");
+ return false;
+ }
+
+ if (!Int32.TryParse (entryLocationColumn.Text, out val)) {
+ warningLocation.Show ();
+ warningLocation.TooltipText = GettextCatalog.GetString ("Column is not a number");
+ return false;
+ }
+
+ if (stopOnLocation.Active) {
+ if (checkPrintExpression.Active && entryPrintExpression.Text.Length == 0) {
+ warningCondition.Show ();
+ warningCondition.TooltipText = GettextCatalog.GetString ("Trace expression not specified");
+ return false;
+ }
+ }
+ } else if (be is Catchpoint) {
+
+ }
+
+ warningFunction.Hide ();
+ warningLocation.Hide ();
+ warningException.Hide ();
+ warningCondition.Hide ();
+
+ // Implement catchpoint
+
+ return true;
+ }
+
+ static bool TryParseFunction (string signature, out string function, out string[] paramTypes)
+ {
+ int paramListStart = signature.IndexOf ('(');
+ int paramListEnd = signature.IndexOf (')');
+
+ if (paramListStart == -1 && paramListEnd == -1) {
+ function = signature;
+ paramTypes = null;
+ return true;
+ }
+
+ if (paramListEnd != signature.Length - 1) {
+ paramTypes = null;
+ function = null;
+ return false;
+ }
+
+ function = signature.Substring (0, paramListStart).Trim ();
+
+ paramListStart++;
+
+ if (!FunctionBreakpoint.TryParseParameters (signature, paramListStart, paramListEnd, out paramTypes)) {
+ paramTypes = null;
+ function = null;
+ return false;
+ }
+
+ return true;
+ }
+
+ void SetLayout ()
+ {
+ var vbox = new Xwt.VBox ();
+ vbox.MinHeight = 400;
+ vbox.MinWidth = 450;
+
+ vbox.PackStart (new Xwt.Label (GettextCatalog.GetString ("Pause program execution in the debugger")));
+
+ // Radio group
+ var vboxRadio = new Xwt.VBox {
+ MarginLeft = 12
+ };
+
+ // Function group
+ vboxRadio.PackStart (stopOnFunction);
+
+ hboxFunction = new Xwt.HBox {
+ MarginLeft = 12
+ };
+ hboxFunction.PackStart (new Xwt.Label (GettextCatalog.GetString ("Function:")));
+ hboxFunction.PackStart (entryFunctionName, true);
+ hboxFunction.PackEnd (warningFunction);
+
+ vboxRadio.PackStart (hboxFunction);
+
+ // Location group
+ vboxRadio.PackStart (stopOnLocation);
+
+ var vboxLocation = new Xwt.VBox {
+ MarginLeft = 12
+ };
+ hboxLocation = new Xwt.HBox ();
+ hboxLocation.PackStart (new Xwt.Label (GettextCatalog.GetString ("Location:")));
+ hboxLocation.PackStart (entryLocationFile, true);
+ hboxLocation.PackEnd (warningLocation);
+ vboxLocation.PackStart (hboxLocation);
+
+ hboxLineColumn = new Xwt.HBox ();
+ hboxLineColumn.PackStart (new Xwt.Label (GettextCatalog.GetString ("Line:")));
+ hboxLineColumn.PackStart (entryLocationLine);
+ hboxLineColumn.PackStart (new Xwt.Label (GettextCatalog.GetString ("Column:")));
+ hboxLineColumn.PackStart (entryLocationColumn);
+ vboxLocation.PackStart (hboxLineColumn);
+
+ vboxRadio.PackStart (vboxLocation);
+
+ // Exception group
+ vboxRadio.PackStart (stopOnException);
+
+ var vboxException = new Xwt.VBox {
+ MarginLeft = 12
+ };
+ hboxException = new Xwt.HBox ();
+ hboxException.PackStart (new Xwt.Label (GettextCatalog.GetString ("Type:")));
+ hboxException.PackStart (entryExceptionType, true);
+ hboxException.PackEnd (warningException);
+
+ vboxException.PackStart (hboxException);
+ vboxException.PackStart (checkIncludeSubclass);
+ vboxRadio.PackStart (vboxException);
+
+ vbox.PackStart (vboxRadio);
+
+ var hboxCondition = new Xwt.HBox ();
+ hboxCondition.PackStart (new Xwt.Label (GettextCatalog.GetString ("Condition:")));
+ hboxCondition.PackStart (entryConditionalExpression, true);
+ hboxCondition.PackEnd (warningCondition);
+ hboxCondition.PackEnd (conditionalHitType);
+
+ vbox.PackStart (hboxCondition);
+
+ var hboxHitCount = new Xwt.HBox ();
+ hboxHitCount.PackStart (new Xwt.Label (GettextCatalog.GetString ("When hit break")));
+ hboxHitCount.PackStart (ignoreHitType);
+ hboxHitCount.PackStart (ignoreHitCount);
+
+ vbox.PackStart (hboxHitCount);
+
+ vbox.PackStart (checkPrintExpression);
+ var vboxExpression = new Xwt.VBox {
+ MarginLeft = 12
+ };
+ vboxExpression.PackStart (entryPrintExpression);
+ vboxExpression.PackStart (checkResumeExecution);
+
+ vbox.PackStart (vboxExpression);
+
+ Buttons.Add (new Xwt.DialogButton (Xwt.Command.Cancel));
+ Buttons.Add (buttonOk);
+
+ Content = vbox;
+
+ OnUpdateControls (null, null);
+ }
+ }
+}
\ No newline at end of file
Modified: main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
===================================================================
@@ -555,46 +555,21 @@ class NewBreakpointHandler: CommandHandler
{
protected override void Run ()
{
- Breakpoint bp = new Breakpoint (IdeApp.Workbench.ActiveDocument.FileName, IdeApp.Workbench.ActiveDocument.Editor.Caret.Line, IdeApp.Workbench.ActiveDocument.Editor.Caret.Column);
- if (DebuggingService.ShowBreakpointProperties (bp, true)) {
- var breakpoints = DebuggingService.Breakpoints;
+ BreakEvent bp = null;
+ if (DebuggingService.ShowBreakpointProperties (ref bp)) {
+ if (bp is Breakpoint) {
+ var breakpoints = DebuggingService.Breakpoints;
- lock (breakpoints)
- breakpoints.Add (bp);
- }
- }
-
- protected override void Update (CommandInfo info)
- {
- info.Visible = DebuggingService.IsFeatureSupported (DebuggerFeatures.Breakpoints);
- if (IdeApp.Workbench.ActiveDocument != null &&
- IdeApp.Workbench.ActiveDocument.Editor != null &&
- IdeApp.Workbench.ActiveDocument.FileName != FilePath.Null &&
- !DebuggingService.Breakpoints.IsReadOnly) {
- info.Enabled = true;
- } else {
- info.Enabled = false;
- }
- }
- }
-
- class NewFunctionBreakpointHandler: CommandHandler
- {
- protected override void Run ()
- {
- FunctionBreakpoint bp = new FunctionBreakpoint ("", "C#");
- if (DebuggingService.ShowBreakpointProperties (bp, true)) {
- var breakpoints = DebuggingService.Breakpoints;
-
- lock (breakpoints)
- breakpoints.Add (bp);
+ lock (breakpoints)
+ breakpoints.Add (bp);
+ }
}
}
protected override void Update (CommandInfo info)
{
info.Visible = DebuggingService.IsFeatureSupported (DebuggerFeatures.Breakpoints);
- info.Enabled = !DebuggingService.Breakpoints.IsReadOnly && IdeApp.Workspace.IsOpen;
+ info.Enabled = !DebuggingService.Breakpoints.IsReadOnly;
}
}
@@ -611,8 +586,10 @@ protected override void Run ()
IdeApp.Workbench.ActiveDocument.Editor.Caret.Line);
}
- if (brs.Count > 0)
- DebuggingService.ShowBreakpointProperties (brs[0], false);
+ if (brs.Count > 0) {
+ BreakEvent be = brs [0];
+ DebuggingService.ShowBreakpointProperties (ref be);
+ }
}
protected override void Update (CommandInfo info)
Modified: main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
===================================================================
@@ -215,12 +215,11 @@ public static void ShowValueVisualizer (ObjectValue val)
MessageService.ShowCustomDialog (dlg);
}
- public static bool ShowBreakpointProperties (Breakpoint bp, bool editNew)
+ public static bool ShowBreakpointProperties (ref BreakEvent bp)
{
- var dlg = new BreakpointPropertiesDialog (bp, editNew);
- if (MessageService.ShowCustomDialog (dlg) == (int) Gtk.ResponseType.Ok)
- return true;
- return false;
+ using (var dlg = new BreakpointPropertiesDialog2 (ref bp)) {
+ return dlg.Run () == Xwt.Command.Ok;
+ }
}
public static void ShowAddTracepointDialog (string file, int line)
Commit: 3db0870e5847795360f25f12b948778200f42a62
Author: Therzok <[email protected]> (Therzok)
Committer: Ungureanu Marius <[email protected]> (Therzok)
Date: 2013-10-19 09:51:35 GMT
URL: https://github.com/mono/monodevelop/commit/3db0870e5847795360f25f12b948778200f42a62
[Debugger] Fixed new Breakpoints Properties dialog to handle catchpoints.
Changed paths:
M main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog2.cs
M main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
M main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
Modified: main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog2.cs
===================================================================
@@ -28,6 +28,9 @@
using MonoDevelop.Core;
using MonoDevelop.Projects;
using MonoDevelop.Ide;
+using System.Collections.Generic;
+using MonoDevelop.Ide.TypeSystem;
+using ICSharpCode.NRefactory.TypeSystem;
namespace MonoDevelop.Debugger
{
@@ -80,11 +83,13 @@ class BreakpointPropertiesDialog2 : Xwt.Dialog
BreakEvent be;
string[] parsedParamTypes;
string parsedFunction;
+ readonly HashSet<string> classes = new HashSet<string> ();
- public BreakpointPropertiesDialog2 (ref BreakEvent be)
+ public BreakpointPropertiesDialog2 (BreakEvent be)
{
this.be = be;
+ LoadExceptionList ();
Initialize ();
SetInitialData ();
SetLayout ();
@@ -174,7 +179,7 @@ void SetInitialBreakpointData (Breakpoint bp)
void SetInitialCatchpointData (Catchpoint cp)
{
-
+ entryExceptionType.Text = cp.ExceptionName;
}
void SetInitialData ()
@@ -186,6 +191,7 @@ void SetInitialData ()
entryLocationFile.ReadOnly = true;
entryLocationLine.ReadOnly = true;
entryLocationColumn.ReadOnly = true;
+ entryExceptionType.ReadOnly = true;
ignoreHitType.SelectedItem = be.HitCountMode;
ignoreHitCount.Value = be.HitCount;
@@ -218,12 +224,10 @@ void SetInitialData ()
SetInitialCatchpointData (cp);
}
- void SaveFunctionBreakpoint (FunctionBreakpoint fb, bool isNew)
+ void SaveFunctionBreakpoint (FunctionBreakpoint fb)
{
- if (isNew) {
- fb.FunctionName = parsedFunction;
- fb.ParamTypes = parsedParamTypes;
- }
+ fb.FunctionName = parsedFunction;
+ fb.ParamTypes = parsedParamTypes;
}
void SaveBreakpoint (Breakpoint bp, bool isNew)
@@ -240,9 +244,13 @@ void SaveBreakpoint (Breakpoint bp, bool isNew)
bp.ConditionExpression = null;
}
- void SaveCatchpoint (Catchpoint cp, bool isNew)
+ void SaveCatchpoint (Catchpoint cp)
{
-
+ if (checkIncludeSubclass.Active) {
+ // add stuff
+ } else {
+ // remove stuff
+ }
}
void OnSave (object sender, EventArgs e)
@@ -263,7 +271,7 @@ void OnSave (object sender, EventArgs e)
var fb = be as FunctionBreakpoint;
if (fb != null)
- SaveFunctionBreakpoint (fb, isNew);
+ SaveFunctionBreakpoint (fb);
var bp = be as Breakpoint;
if (bp != null)
@@ -271,7 +279,7 @@ void OnSave (object sender, EventArgs e)
var cp = be as Catchpoint;
if (cp != null)
- SaveCatchpoint (cp, isNew);
+ SaveCatchpoint (cp);
be.HitCountMode = (HitCountMode)ignoreHitType.SelectedItem;
be.HitCount = be.HitCountMode != HitCountMode.None ? (int)ignoreHitCount.Value : 0;
@@ -361,7 +369,11 @@ bool CheckValidity ()
}
}
} else if (be is Catchpoint) {
-
+ if (!classes.Contains (entryExceptionType.Text)) {
+ warningException.Show ();
+ warningException.TooltipText = GettextCatalog.GetString ("Exception not identified");
+ return false;
+ }
}
warningFunction.Hide ();
@@ -369,8 +381,6 @@ bool CheckValidity ()
warningException.Hide ();
warningCondition.Hide ();
- // Implement catchpoint
-
return true;
}
@@ -404,6 +414,30 @@ static bool TryParseFunction (string signature, out string function, out string[
return true;
}
+ void LoadExceptionList ()
+ {
+ classes.Add ("System.Exception");
+ if (IdeApp.ProjectOperations.CurrentSelectedProject != null) {
+ var dom = TypeSystemService.GetCompilation (IdeApp.ProjectOperations.CurrentSelectedProject);
+ foreach (var t in dom.FindType (typeof (Exception)).GetSubTypeDefinitions ())
+ classes.Add (t.ReflectionName);
+ } else {
+ // no need to unload this assembly context, it's not cached.
+ var unresolvedAssembly = TypeSystemService.LoadAssemblyContext (Runtime.SystemAssemblyService.CurrentRuntime, MonoDevelop.Core.Assemblies.TargetFramework.Default, typeof(Uri).Assembly.Location);
+ var mscorlib = TypeSystemService.LoadAssemblyContext (Runtime.SystemAssemblyService.CurrentRuntime, MonoDevelop.Core.Assemblies.TargetFramework.Default, typeof(object).Assembly.Location);
+ if (unresolvedAssembly != null && mscorlib != null) {
+ var dom = new ICSharpCode.NRefactory.TypeSystem.Implementation.SimpleCompilation (unresolvedAssembly, mscorlib);
+ foreach (var t in dom.FindType (typeof (Exception)).GetSubTypeDefinitions ())
+ classes.Add (t.ReflectionName);
+ }
+ }
+ }
+
+ public BreakEvent GetBreakEvent ()
+ {
+ return be;
+ }
+
void SetLayout ()
{
var vbox = new Xwt.VBox ();
Modified: main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
===================================================================
@@ -557,12 +557,10 @@ protected override void Run ()
{
BreakEvent bp = null;
if (DebuggingService.ShowBreakpointProperties (ref bp)) {
- if (bp is Breakpoint) {
- var breakpoints = DebuggingService.Breakpoints;
+ var breakpoints = DebuggingService.Breakpoints;
- lock (breakpoints)
- breakpoints.Add (bp);
- }
+ lock (breakpoints)
+ breakpoints.Add (bp);
}
}
Modified: main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
===================================================================
@@ -217,8 +217,11 @@ public static void ShowValueVisualizer (ObjectValue val)
public static bool ShowBreakpointProperties (ref BreakEvent bp)
{
- using (var dlg = new BreakpointPropertiesDialog2 (ref bp)) {
- return dlg.Run () == Xwt.Command.Ok;
+ using (var dlg = new BreakpointPropertiesDialog2 (bp)) {
+ Xwt.Command response = dlg.Run ();
+ if (bp == null)
+ bp = dlg.GetBreakEvent ();
+ return response == Xwt.Command.Ok;
}
}
Commit: 3219ddab2af1853d0960217a7820088ba7cf48d4
Author: Therzok <[email protected]> (Therzok)
Committer: Ungureanu Marius <[email protected]> (Therzok)
Date: 2013-10-19 09:51:35 GMT
URL: https://github.com/mono/monodevelop/commit/3219ddab2af1853d0960217a7820088ba7cf48d4
[Debugger] Removed Catchpoints dialog.
Integrated catchpoints into breakpoints pad.
Changed paths:
M main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml
M main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj
M main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs
M main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog2.cs
M main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
M main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
Removed paths:
D main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionsDialog.cs
Modified: main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml
===================================================================
@@ -154,9 +154,6 @@
_label = "Expression Evaluator"
shortcut = "Shift|F9"
defaultHandler = "MonoDevelop.Debugger.ExpressionEvaluatorCommand" />
- <Command id = "MonoDevelop.Debugger.DebugCommands.SelectExceptions"
- _label = "Exceptions..."
- defaultHandler = "MonoDevelop.Debugger.SelectExceptionsCommand" />
<Command id = "MonoDevelop.Debugger.DebugCommands.ShowCurrentExecutionLine"
_label = "Show Current Execution Line"
shortcut = "Alt|*"
@@ -195,7 +192,6 @@
<CommandItem id = "MonoDevelop.Debugger.DebugCommands.EnableDisableBreakpoint" />
<CommandItem id = "MonoDevelop.Debugger.DebugCommands.DisableAllBreakpoints" />
<CommandItem id = "MonoDevelop.Debugger.DebugCommands.ClearAllBreakpoints" />
- <CommandItem id = "MonoDevelop.Debugger.DebugCommands.SelectExceptions" />
<SeparatorItem id = "MonoDevelop.Debugger.ToolsSection" />
<CommandItem id = "MonoDevelop.Debugger.DebugCommands.ExpressionEvaluator" />
</Extension>
Modified: main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.csproj
===================================================================
@@ -116,7 +116,6 @@
<Compile Include="MonoDevelop.Debugger\DebugCommands.cs" />
<Compile Include="MonoDevelop.Debugger\Extensions.cs" />
<Compile Include="MonoDevelop.Debugger\AttachToProcessDialog.cs" />
- <Compile Include="MonoDevelop.Debugger\ExceptionsDialog.cs" />
<Compile Include="gtk-gui\MonoDevelop.Debugger.ExceptionsDialog.cs" />
<Compile Include="gtk-gui\MonoDevelop.Debugger.AttachToProcessDialog.cs" />
<Compile Include="MonoDevelop.Debugger\ExpressionEvaluatorDialog.cs" />
Modified: main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs
===================================================================
@@ -45,7 +45,7 @@ public class BreakpointPad : IPadContent
BreakpointStore breakpoints;
PadTreeView tree;
- Gtk.TreeStore store;
+ TreeStore store;
Widget control;
ScrolledWindow sw;
CommandEntrySet menuSet;
@@ -225,7 +225,7 @@ protected void OnEnableDisable ()
if (!store.GetIter (out iter, path))
continue;
- Breakpoint bp = (Breakpoint) store.GetValue (iter, (int) Columns.Breakpoint);
+ BreakEvent bp = (BreakEvent) store.GetValue (iter, (int) Columns.Breakpoint);
if (!bp.Enabled) {
enable = true;
break;
@@ -238,7 +238,7 @@ protected void OnEnableDisable ()
if (!store.GetIter (out iter, path))
continue;
- Breakpoint bp = (Breakpoint) store.GetValue (iter, (int) Columns.Breakpoint);
+ BreakEvent bp = (BreakEvent) store.GetValue (iter, (int) Columns.Breakpoint);
bp.Enabled = enable;
store.SetValue (iter, (int) Columns.Icon, enable ? "md-breakpoint" : "md-breakpoint-disabled");
@@ -256,9 +256,12 @@ protected void OnBpJumpTo ()
TreeIter iter;
if (selected.Length == 1 && store.GetIter (out iter, selected[0])) {
- Breakpoint bp = (Breakpoint) store.GetValue (iter, (int) Columns.Breakpoint);
- if (!string.IsNullOrEmpty (bp.FileName))
- IdeApp.Workbench.OpenDocument (bp.FileName, bp.Line, 1);
+ var be = (BreakEvent) store.GetValue (iter, (int) Columns.Breakpoint);
+ var bp = be as Breakpoint;
+ if (bp != null) {
+ if (!string.IsNullOrEmpty (bp.FileName))
+ IdeApp.Workbench.OpenDocument (bp.FileName, bp.Line, 1);
+ }
}
}
@@ -280,7 +283,7 @@ bool DeleteSelectedBreakpoints ()
if (!store.GetIter (out iter, path))
continue;
- var bp = (Breakpoint) store.GetValue (iter, (int) Columns.Breakpoint);
+ var bp = (BreakEvent) store.GetValue (iter, (int) Columns.Breakpoint);
lock (breakpoints)
breakpoints.Remove (bp);
deleted = true;
@@ -359,7 +362,7 @@ void ItemToggled (object o, ToggledArgs args)
TreeIter iter;
if (store.GetIterFromString (out iter, args.Path)) {
- Breakpoint bp = (Breakpoint) store.GetValue (iter, (int) Columns.Breakpoint);
+ BreakEvent bp = (BreakEvent) store.GetValue (iter, (int) Columns.Breakpoint);
bp.Enabled = !bp.Enabled;
store.SetValue (iter, (int) Columns.Icon, bp.Enabled ? "md-breakpoint" : "md-breakpoint-disabled");
@@ -380,27 +383,32 @@ public void UpdateDisplay ()
store.Clear ();
if (breakpoints != null) {
lock (breakpoints) {
- foreach (Breakpoint bp in breakpoints.GetBreakpoints ()) {
- string hitCount = bp.HitCountMode != HitCountMode.None ? bp.CurrentHitCount.ToString () : "";
- string traceExp = bp.HitAction == HitAction.PrintExpression ? bp.TraceExpression : "";
- string traceVal = bp.HitAction == HitAction.PrintExpression ? bp.LastTraceValue : "";
+ foreach (BreakEvent be in breakpoints.GetBreakevents ()) {
+ string hitCount = be.HitCountMode != HitCountMode.None ? be.CurrentHitCount.ToString () : "";
+ string traceExp = be.HitAction == HitAction.PrintExpression ? be.TraceExpression : "";
+ string traceVal = be.HitAction == HitAction.PrintExpression ? be.LastTraceValue : "";
string name;
- if (bp is FunctionBreakpoint) {
- FunctionBreakpoint fb = (FunctionBreakpoint) bp;
-
+ var fb = be as FunctionBreakpoint;
+ var bp = be as Breakpoint;
+ var cp = be as Catchpoint;
+ if (fb != null) {
if (fb.ParamTypes != null)
name = fb.FunctionName + "(" + string.Join (", ", fb.ParamTypes) + ")";
else
name = fb.FunctionName;
+ } else if (bp != null) {
+ name = String.Format ("{0}:{1},{2}", bp.FileName, bp.Line, bp.Column);
+ } else if (cp != null) {
+ name = cp.ExceptionName;
} else {
- name = string.Format ("{0}:{1},{2}", ((Breakpoint) bp).FileName, bp.Line, bp.Column);
+ name = "";
}
- if (bp.Enabled)
- store.AppendValues ("md-breakpoint", true, name, bp, bp.ConditionExpression, traceExp, hitCount, traceVal);
+ if (be.Enabled)
+ store.AppendValues ("md-breakpoint", true, name, be, bp != null ? bp.ConditionExpression : null, traceExp, hitCount, traceVal);
else
- store.AppendValues ("md-breakpoint-disabled", false, name, bp, bp.ConditionExpression, traceExp, hitCount, traceVal);
+ store.AppendValues ("md-breakpoint-disabled", false, name, be, bp != null ? bp.ConditionExpression : null, traceExp, hitCount, traceVal);
}
}
}
@@ -416,7 +424,7 @@ void OnBreakpointUpdated (object s, BreakpointEventArgs args)
return;
do {
- Breakpoint bp = (Breakpoint) store.GetValue (it, (int) Columns.Breakpoint);
+ var bp = (BreakEvent) store.GetValue (it, (int) Columns.Breakpoint);
if (bp == args.Breakpoint) {
string hitCount = bp.HitCountMode != HitCountMode.None ? bp.CurrentHitCount.ToString () : "";
string traceVal = bp.HitAction == HitAction.PrintExpression ? bp.LastTraceValue : "";
Modified: main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog2.cs
===================================================================
@@ -49,6 +49,7 @@ class BreakpointPropertiesDialog2 : Xwt.Dialog
Xwt.HBox hboxLocation = new Xwt.HBox ();
Xwt.HBox hboxLineColumn = new Xwt.HBox ();
Xwt.HBox hboxException = new Xwt.HBox ();
+ Xwt.HBox hboxCondition = new Xwt.HBox ();
// Stop-type radios.
readonly Xwt.RadioButton stopOnFunction = new Xwt.RadioButton (GettextCatalog.GetString ("When a function is entered"));
@@ -97,7 +98,6 @@ public BreakpointPropertiesDialog2 (BreakEvent be)
void Initialize ()
{
- // TODO: Make dialog for exceptions.
Title = GettextCatalog.GetString (be == null ? "New Breakpoint" : "Breakpoint Properties");
var buttonLabel = GettextCatalog.GetString (be == null ? "Add breakpoint" : "Modify breakpoint");
@@ -134,6 +134,10 @@ void Initialize ()
ignoreHitType.SelectionChanged += OnUpdateControls;
checkPrintExpression.Toggled += OnUpdateControls;
+ entryFunctionName.Changed += OnUpdateText;
+ entryLocationFile.Changed += OnUpdateText;
+ entryExceptionType.Changed += OnUpdateText;
+
buttonOk.Clicked += OnSave;
}
@@ -201,14 +205,14 @@ void SetInitialData ()
entryPrintExpression.Text = be.TraceExpression;
}
} else {
+ ignoreHitType.SelectedItem = HitCountMode.None;
+ conditionalHitType.SelectedItem = ConditionalHitWhen.ConditionIsTrue;
+
if (IdeApp.Workbench.ActiveDocument != null) {
entryLocationFile.Text = IdeApp.Workbench.ActiveDocument.FileName;
entryLocationLine.Text = IdeApp.Workbench.ActiveDocument.Editor.Caret.Line.ToString ();
entryLocationColumn.Text = IdeApp.Workbench.ActiveDocument.Editor.Caret.Column.ToString ();
}
-
- ignoreHitType.SelectedItem = HitCountMode.None;
- conditionalHitType.SelectedItem = ConditionalHitWhen.ConditionIsTrue;
}
var fb = be as FunctionBreakpoint;
@@ -302,6 +306,7 @@ void OnUpdateControls (object sender, EventArgs e)
hboxLocation.Sensitive = stopOnLocation.Active;
hboxException.Sensitive = stopOnException.Active;
checkIncludeSubclass.Sensitive = stopOnException.Active;
+ hboxCondition.Sensitive = !stopOnException.Active;
// Check conditional
if (!String.IsNullOrEmpty (entryConditionalExpression.Text))
@@ -323,6 +328,13 @@ void OnUpdateControls (object sender, EventArgs e)
buttonOk.Sensitive = CheckValidity ();
}
+ void OnUpdateText (object sender, EventArgs e)
+ {
+
+
+ buttonOk.Sensitive = CheckValidity ();
+ }
+
bool CheckValidity ()
{
if (be is FunctionBreakpoint) {
@@ -501,7 +513,7 @@ void SetLayout ()
vbox.PackStart (vboxRadio);
- var hboxCondition = new Xwt.HBox ();
+ hboxCondition = new Xwt.HBox ();
hboxCondition.PackStart (new Xwt.Label (GettextCatalog.GetString ("Condition:")));
hboxCondition.PackStart (entryConditionalExpression, true);
hboxCondition.PackEnd (warningCondition);
Modified: main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
===================================================================
@@ -59,7 +59,6 @@ public enum DebugCommands
RemoveBreakpoint,
ShowBreakpointProperties,
ExpressionEvaluator,
- SelectExceptions,
ShowCurrentExecutionLine,
AddTracepoint,
AddWatch,
@@ -620,19 +619,6 @@ protected override void Update (CommandInfo info)
info.Enabled = DebuggingService.CurrentFrame != null;
}
}
-
- class SelectExceptionsCommand: CommandHandler
- {
- protected override void Run ()
- {
- DebuggingService.ShowExceptionsFilters ();
- }
-
- protected override void Update (CommandInfo info)
- {
- info.Visible = DebuggingService.IsFeatureSupported (DebuggerFeatures.Catchpoints);
- }
- }
class ShowCurrentExecutionLineCommand : CommandHandler
{
Modified: main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
===================================================================
@@ -327,11 +327,6 @@ static void HideExceptionCaughtDialog ()
return exceptionDialog;
}
}
-
- public static void ShowExceptionsFilters ()
- {
- MessageService.ShowCustomDialog (new ExceptionsDialog ());
- }
static void SetupSession ()
{
Removed: main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionsDialog.cs
===================================================================
@@ -1,245 +0,0 @@
-// ExceptionsDialog.cs
-//
-// Author:
-// Lluis Sanchez Gual <[email protected]>
-//
-// Copyright (c) 2008 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-//
-//
-
-using System;
-using System.Collections.Generic;
-using Gtk;
-using MonoDevelop.Core;
-using MonoDevelop.Components;
-using Mono.Debugging.Client;
-using MonoDevelop.Ide;
-using ICSharpCode.NRefactory.TypeSystem;
-using MonoDevelop.Ide.TypeSystem;
-
-namespace MonoDevelop.Debugger
-{
- public partial class ExceptionsDialog : Gtk.Dialog
- {
- ListStore storeExceptions;
- ListStore storeSelection;
- HashSet<string> classes = new HashSet<string> ();
- TreeViewState tstateExc;
- TreeViewState tstateSel;
- bool updateScheduled;
- HashSet<string> selectedClasses = new HashSet<string> ();
-
- public ExceptionsDialog()
- {
- this.Build ();
-
- storeExceptions = new ListStore (typeof(String));
- treeExceptions.Selection.Mode = SelectionMode.Multiple;
- treeExceptions.Model = storeExceptions;
- treeExceptions.AppendColumn ("", new CellRendererText (), "text", 0);
- tstateExc = new TreeViewState (treeExceptions, 0);
- storeExceptions.SetSortColumnId (0, SortType.Ascending);
-
- storeSelection = new ListStore (typeof(String));
- treeSelected.Selection.Mode = SelectionMode.Multiple;
- treeSelected.Model = storeSelection;
- treeSelected.AppendColumn ("", new CellRendererText (), "text", 0);
- tstateSel = new TreeViewState (treeSelected, 0);
- storeSelection.SetSortColumnId (0, SortType.Ascending);
-
- var breakpoints = DebuggingService.Breakpoints;
- lock (breakpoints) {
- foreach (Catchpoint cp in breakpoints.GetCatchpoints ())
- selectedClasses.Add (cp.ExceptionName);
- }
-
- LoadExceptions ();
-
- FillSelection ();
- FillExceptions ();
- }
-
- void LoadExceptions ()
- {
- classes.Add ("System.Exception");
- if (IdeApp.ProjectOperations.CurrentSelectedProject != null) {
- var dom = TypeSystemService.GetCompilation (IdeApp.ProjectOperations.CurrentSelectedProject);
- foreach (var t in dom.FindType (typeof (Exception)).GetSubTypeDefinitions ())
- classes.Add (t.ReflectionName);
- } else {
- // no need to unload this assembly context, it's not cached.
- var unresolvedAssembly = TypeSystemService.LoadAssemblyContext (Runtime.SystemAssemblyService.CurrentRuntime, MonoDevelop.Core.Assemblies.TargetFramework.Default, typeof(Uri).Assembly.Location);
- var mscorlib = TypeSystemService.LoadAssemblyContext (Runtime.SystemAssemblyService.CurrentRuntime, MonoDevelop.Core.Assemblies.TargetFramework.Default, typeof(object).Assembly.Location);
- if (unresolvedAssembly != null && mscorlib != null) {
- var dom = new ICSharpCode.NRefactory.TypeSystem.Implementation.SimpleCompilation (unresolvedAssembly, mscorlib);
- foreach (var t in dom.FindType (typeof (Exception)).GetSubTypeDefinitions ())
- classes.Add (t.ReflectionName);
- }
- }
- }
-
- void FillExceptions ()
- {
- tstateExc.Save ();
- storeExceptions.Clear ();
- string filter = entryFilter.Text;
- foreach (string t in classes) {
- if ((filter.Length == 0 || t.IndexOf (filter, StringComparison.OrdinalIgnoreCase) != -1) && !selectedClasses.Contains (t))
- storeExceptions.AppendValues (t);
- }
- tstateExc.Load ();
- if (treeExceptions.Selection.CountSelectedRows () == 0) {
- TreeIter it;
- if (storeExceptions.GetIterFirst (out it))
- treeExceptions.Selection.SelectIter (it);
- }
- }
-
- void FillSelection ()
- {
- tstateSel.Save ();
- storeSelection.Clear ();
- foreach (string exc in selectedClasses)
- storeSelection.AppendValues (exc);
- tstateSel.Load ();
- if (treeSelected.Selection.CountSelectedRows () == 0) {
- TreeIter it;
- if (storeSelection.GetIterFirst (out it))
- treeSelected.Selection.SelectIter (it);
- }
- }
-
- protected virtual void OnEntryFilterChanged (object sender, System.EventArgs e)
- {
- if (!updateScheduled) {
- updateScheduled = true;
- GLib.Timeout.Add (200, delegate {
- updateScheduled = false;
- FillExceptions ();
- return false;
- });
- }
- }
-
- protected virtual void OnButtonAddClicked (object sender, System.EventArgs e)
- {
- foreach (TreePath path in treeExceptions.Selection.GetSelectedRows ()) {
- TreeIter it;
- if (storeExceptions.GetIter (out it, path)) {
- string exc = (string) storeExceptions.GetValue (it, 0);
- selectedClasses.Add (exc);
- }
- }
- SelectNearest (treeExceptions);
- FillSelection ();
- FillExceptions ();
- }
-
- protected virtual void OnButtonRemoveClicked (object sender, System.EventArgs e)
- {
- foreach (TreePath path in treeSelected.Selection.GetSelectedRows ()) {
- TreeIter it;
- if (storeSelection.GetIter (out it, path)) {
- string exc = (string) storeSelection.GetValue (it, 0);
- selectedClasses.Remove (exc);
- }
- }
- SelectNearest (treeSelected);
- FillSelection ();
- FillExceptions ();
- }
-
- void SelectNearest (TreeView view)
- {
- ListStore store = (ListStore) view.Model;
- TreePath[] paths = view.Selection.GetSelectedRows ();
- if (paths.Length == 0)
- return;
- TreeIter it;
- store.GetIter (out it, paths [paths.Length - 1]);
- if (store.IterNext (ref it)) {
- view.Selection.UnselectAll ();
- view.Selection.SelectIter (it);
- return;
- }
- store.GetIter (out it, paths [0]);
- if (store.IterNext (ref it)) {
- view.Selection.UnselectAll ();
- view.Selection.SelectIter (it);
- return;
- }
- }
-
- protected virtual void OnEntryFilterActivated (object sender, EventArgs e)
- {
- OnButtonAddClicked (null, null);
- }
-
- protected virtual void OnButtonOkClicked (object sender, EventArgs e)
- {
- var breakpoints = DebuggingService.Breakpoints;
-
- lock (breakpoints) {
- foreach (Catchpoint cp in new List<Catchpoint> (breakpoints.GetCatchpoints ())) {
- if (!selectedClasses.Contains (cp.ExceptionName))
- breakpoints.Remove (cp);
- else
- selectedClasses.Remove (cp.ExceptionName);
- }
-
- foreach (string exc in selectedClasses)
- breakpoints.AddCatchpoint (exc);
- }
- }
-
- [GLib.ConnectBefore]
- protected virtual void OnTreeSelectedKeyPressEvent (object o, Gtk.KeyPressEventArgs args)
- {
- if (args.Event.Key == Gdk.Key.Return || args.Event.Key == Gdk.Key.KP_Enter) {
- OnButtonRemoveClicked (null, null);
- args.RetVal = true;
- }
- }
-
- [GLib.ConnectBefore]
- protected virtual void OnTreeSelectedButtonPressEvent (object o, Gtk.ButtonPressEventArgs args)
- {
- if (args.Event.Button == 1 && args.Event.Type == Gdk.EventType.TwoButtonPress)
- OnButtonRemoveClicked (o, args);
- }
-
- [GLib.ConnectBefore]
- protected virtual void OnTreeExceptionsKeyPressEvent (object o, Gtk.KeyPressEventArgs args)
- {
- if (args.Event.Key == Gdk.Key.Return || args.Event.Key == Gdk.Key.KP_Enter) {
- OnButtonAddClicked (null, null);
- args.RetVal = true;
- }
- }
-
- [GLib.ConnectBefore]
- protected virtual void OnTreeExceptionsButtonPressEvent (object o, Gtk.ButtonPressEventArgs args)
- {
- if (args.Event.Button == 1 && args.Event.Type == Gdk.EventType.TwoButtonPress)
- OnButtonAddClicked (o, args);
- }
- }
-}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches