~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/BackendBindings/Ruby/RubyBinding/Project/Src/RubyConsole.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 System.Collections.Generic;
 
6
using System.IO;
 
7
 
 
8
using ICSharpCode.Scripting;
 
9
using Microsoft.Scripting.Hosting.Shell;
 
10
 
 
11
namespace ICSharpCode.RubyBinding
 
12
{
 
13
        public class RubyConsole : ThreadSafeScriptingConsole, IConsole, IMemberProvider
 
14
        {
 
15
                IScriptingConsoleTextEditor textEditor;
 
16
                IControlDispatcher dispatcher;
 
17
                
 
18
                public RubyConsole(IScriptingConsoleTextEditor textEditor, IControlDispatcher dispatcher)
 
19
                        : this(new ScriptingConsole(textEditor), dispatcher)
 
20
                {
 
21
                        this.textEditor = textEditor;
 
22
                }
 
23
                
 
24
                RubyConsole(ScriptingConsole console, IControlDispatcher dispatcher)
 
25
                        : base(console, dispatcher)
 
26
                {
 
27
                        this.dispatcher = dispatcher;
 
28
                        console.MemberProvider = this;
 
29
                }
 
30
                
 
31
                public ScriptingConsoleOutputStream CreateOutputStream()
 
32
                {
 
33
                        return new ScriptingConsoleOutputStream(textEditor, dispatcher);
 
34
                }
 
35
                
 
36
                public CommandLine CommandLine { get; set; }                    
 
37
 
 
38
                public TextWriter Output {
 
39
                        get { return null; }
 
40
                        set { }
 
41
                }
 
42
                
 
43
                public TextWriter ErrorOutput {
 
44
                        get { return null; }
 
45
                        set { }
 
46
                }
 
47
                
 
48
                public void Write(string text, Style style)
 
49
                {
 
50
                        base.Write(text, (ScriptingStyle)style);
 
51
                }
 
52
                
 
53
                public void WriteLine(string text, Style style)
 
54
                {
 
55
                        base.WriteLine(text, (ScriptingStyle)style);
 
56
                }
 
57
                
 
58
                public IList<string> GetMemberNames(string name)
 
59
                {
 
60
                        return CommandLine.GetMemberNames(name);
 
61
                }
 
62
                
 
63
                public IList<string> GetGlobals(string name)
 
64
                {
 
65
                        return CommandLine.GetGlobals(name);
 
66
                }
 
67
        }
 
68
}