~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/Scripting/Project/Src/SendLineToScriptingConsoleCommand.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using ICSharpCode.SharpDevelop.Editor;
 
6
 
 
7
namespace ICSharpCode.Scripting
 
8
{
 
9
        public class SendLineToScriptingConsoleCommand : SendToScriptingConsoleCommand
 
10
        {
 
11
                string lineFromActiveTextEditor;
 
12
                
 
13
                public SendLineToScriptingConsoleCommand(IScriptingWorkbench workbench)
 
14
                        : base(workbench)
 
15
                {
 
16
                }       
 
17
                
 
18
                public override void Run()
 
19
                {
 
20
                        GetLineFromActiveTextEditor();
 
21
                        GetScriptingConsolePad();
 
22
                        ShowScriptingConsolePad();
 
23
                        AppendLineToScriptingConsole();
 
24
                }
 
25
                
 
26
                void GetLineFromActiveTextEditor()
 
27
                {
 
28
                        int lineNumber = activeTextEditor.Caret.Line;
 
29
                        IDocumentLine documentLine =  activeTextEditor.Document.GetLine(lineNumber);
 
30
                        lineFromActiveTextEditor = documentLine.Text;
 
31
                }
 
32
                
 
33
                void AppendLineToScriptingConsole()
 
34
                {
 
35
                        GetScriptingConsole();
 
36
                        scriptingConsole.SendLine(lineFromActiveTextEditor);
 
37
                }
 
38
        }
 
39
}