pascalabcnet/VisualPascalABCNET/IB/Debugger/Actions.cs

47 lines
1.7 KiB
C#
Raw Permalink Normal View History

// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
2015-06-02 22:52:35 +03:00
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
2015-05-14 22:35:07 +03:00
using ICSharpCode.TextEditor;
namespace VisualPascalABC
{
public class AddToWatchAction : ICSharpCode.TextEditor.Actions.AbstractEditAction
{
public override void Execute(TextArea textArea)
{
try
{
int num_line = 0;
string var = null;
if (!textArea.SelectionManager.HasSomethingSelected)
var = WorkbenchServiceFactory.DebuggerManager.GetVariable(textArea, out num_line);
else
{
var = textArea.SelectionManager.SelectedText;
//num_line = textArea.SelectionManager.SelectionStart.Line;
}
if (var == null || var == "")
{
WorkbenchServiceFactory.DebuggerOperationsService.GotoWatch();
return;
//VisualPABCSingleton.MainForm.SetCursorInWatch();
}
ValueItem vi = WorkbenchServiceFactory.DebuggerManager.FindVarByName(var, num_line) as ValueItem;
if (vi != null)
{
VisualPABCSingleton.MainForm.AddVariable(vi);
}
else
{
WorkbenchServiceFactory.DebuggerOperationsService.AddVariable(var, true);
}
}
catch (System.Exception)
2015-05-14 22:35:07 +03:00
{
WorkbenchServiceFactory.DebuggerOperationsService.GotoWatch();
}
}
}
}