pascalabcnet/VisualPascalABCNET/IB/Debugger/Actions.cs
Бондарев Иван 0983257ee6 added license info
2015-06-02 21:52:35 +02:00

47 lines
1.7 KiB
C#

// Copyright (c) Ivan Bondarev, Stanislav Mihalkovich (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
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 e)
{
WorkbenchServiceFactory.DebuggerOperationsService.GotoWatch();
}
}
}
}