pascalabcnet/VisualPascalABCNET/IB/Debugger/Immediate.cs
Бондарев Иван e6e67c193c initial commit
2015-05-14 21:35:07 +02:00

35 lines
982 B
C#

using System;
using System.Collections.Generic;
using PascalABCCompiler.SyntaxTree;
using System.Text;
using Debugger;
namespace VisualPascalABC
{
public class ImmediateEvaluateAction : ICSharpCode.TextEditor.Actions.AbstractEditAction
{
public override void Execute(ICSharpCode.TextEditor.TextArea textArea)
{
if (WorkbenchServiceFactory.DebuggerManager.IsRunning)
{
int line = textArea.Caret.Line;
string val = WorkbenchServiceFactory.DebuggerManager.ExecuteImmediate
(textArea.Document.GetText(textArea.Document.GetLineSegment(textArea.Caret.Line)));
if (val != null)
{
textArea.Document.TextContent += Environment.NewLine+val+Environment.NewLine;
textArea.Caret.Line = line + 2;
textArea.Caret.Column = 0;
}
}
else
{
int line = textArea.Caret.Line;
textArea.Document.TextContent += Environment.NewLine;
textArea.Caret.Line = line + 1;
textArea.Caret.Column = 0;
}
}
}
}