Browse Source
git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1581 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61shortcuts
34 changed files with 2443 additions and 2335 deletions
@ -0,0 +1,55 @@ |
|||||||
|
// <file> |
||||||
|
// <copyright see="prj:///doc/copyright.txt"/> |
||||||
|
// <license see="prj:///doc/license.txt"/> |
||||||
|
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/> |
||||||
|
// <version>$Revision$</version> |
||||||
|
// </file> |
||||||
|
|
||||||
|
namespace Boo.InterpreterAddIn |
||||||
|
|
||||||
|
import System |
||||||
|
import System.Windows.Forms |
||||||
|
import ICSharpCode.Core |
||||||
|
import ICSharpCode.SharpDevelop.Gui |
||||||
|
|
||||||
|
class ContextEntry: |
||||||
|
[getter(InterpreterControl)] |
||||||
|
_ctl as InteractiveInterpreterControl |
||||||
|
|
||||||
|
[getter(Context)] |
||||||
|
_context as InterpreterContext |
||||||
|
|
||||||
|
[getter(ToolBarItem)] |
||||||
|
_item as ToolStripButton |
||||||
|
|
||||||
|
_parentPad as InterpreterPad |
||||||
|
|
||||||
|
def constructor([required] context as InterpreterContext, [required] parentPad as InterpreterPad): |
||||||
|
_context = context |
||||||
|
_parentPad = parentPad |
||||||
|
|
||||||
|
_ctl = InteractiveInterpreterControl(context) |
||||||
|
_ctl.Dock = DockStyle.Fill |
||||||
|
|
||||||
|
_item = ToolStripButton(StringParser.Parse(context.Title), context.Image) |
||||||
|
_item.ToolTipText = context.ToolTipText |
||||||
|
_item.Visible = context.Visible |
||||||
|
_item.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText |
||||||
|
|
||||||
|
context.ImageChanged += AutoInvoke() do: |
||||||
|
_item.Image = _context.Image |
||||||
|
context.TitleChanged += AutoInvoke() do: |
||||||
|
_item.Text = StringParser.Parse(_context.Title) |
||||||
|
context.ToolTipTextChanged += AutoInvoke() do: |
||||||
|
_item.ToolTipText = StringParser.Parse(_context.ToolTipText) |
||||||
|
context.VisibleChanged += AutoInvoke() do: |
||||||
|
_item.Visible = _context.Visible |
||||||
|
_parentPad.UpdateToolBarVisible() |
||||||
|
if _parentPad.CurrentContext is self and _context.Visible == false: |
||||||
|
_parentPad.ActivateFirstVisibleContext() |
||||||
|
_item.Click += def: |
||||||
|
_parentPad.CurrentContext = self |
||||||
|
|
||||||
|
private static def AutoInvoke(what as callable()) as EventHandler: |
||||||
|
return def(sender as object, e as EventArgs): |
||||||
|
WorkbenchSingleton.SafeThreadAsyncCall(what) |
@ -0,0 +1,61 @@ |
|||||||
|
// <file> |
||||||
|
// <copyright see="prj:///doc/copyright.txt"/> |
||||||
|
// <license see="prj:///doc/license.txt"/> |
||||||
|
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/> |
||||||
|
// <version>$Revision$</version> |
||||||
|
// </file> |
||||||
|
|
||||||
|
namespace Boo.InterpreterAddIn |
||||||
|
|
||||||
|
import System |
||||||
|
import System.Reflection |
||||||
|
|
||||||
|
class DefaultBooInterpreterContext(InterpreterContext): |
||||||
|
_interpreter as Boo.Lang.Interpreter.InteractiveInterpreter |
||||||
|
_isAdditionalTab as bool |
||||||
|
|
||||||
|
def constructor(): |
||||||
|
self.Image = ICSharpCode.Core.ResourceService.GetBitmap("Boo.ProjectIcon") |
||||||
|
|
||||||
|
def constructor(isAdditionalTab as bool): |
||||||
|
self() |
||||||
|
if isAdditionalTab: |
||||||
|
self.Title = "New " + self.Title |
||||||
|
_isAdditionalTab = true |
||||||
|
|
||||||
|
private def AddAssemblies(main as Assembly): |
||||||
|
_interpreter.References.Add(main) |
||||||
|
for reference in main.GetReferencedAssemblies(): |
||||||
|
_interpreter.References.Add(Assembly.Load(reference.FullName)) |
||||||
|
|
||||||
|
private def InitInterpreter(): |
||||||
|
_interpreter = Boo.Lang.Interpreter.InteractiveInterpreter( |
||||||
|
RememberLastValue: true, |
||||||
|
Print: self.PrintLine) |
||||||
|
AddAssemblies(typeof(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton).Assembly) |
||||||
|
_interpreter.SetValue("cls", RaiseClear) |
||||||
|
_interpreter.SetValue("newTab") do(): |
||||||
|
InterpreterPad.Instance.AddInterpreterContext(c = DefaultBooInterpreterContext(true)) |
||||||
|
return c |
||||||
|
if _isAdditionalTab: |
||||||
|
_interpreter.SetValue("thisTab", self) |
||||||
|
|
||||||
|
_interpreter.LoopEval(""" |
||||||
|
import System |
||||||
|
import System.IO |
||||||
|
import System.Text |
||||||
|
""") |
||||||
|
|
||||||
|
def RunCommand(code as string): |
||||||
|
InitInterpreter() if _interpreter is null |
||||||
|
try: |
||||||
|
_interpreter.LoopEval(code) |
||||||
|
except x as System.Reflection.TargetInvocationException: |
||||||
|
PrintLine(x.InnerException.ToString()) |
||||||
|
|
||||||
|
def GetGlobals(): |
||||||
|
InitInterpreter() if _interpreter is null |
||||||
|
return _interpreter.globals() |
||||||
|
|
||||||
|
def CloseTab(): |
||||||
|
InterpreterPad.Instance.RemoveInterpreterContext(self) |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,51 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Daniel Grunwald |
||||||
|
* Date: 15.07.2006 |
||||||
|
* Time: 19:49 |
||||||
|
*/ |
||||||
|
|
||||||
|
using System; |
||||||
|
|
||||||
|
namespace ICSharpCode.NRefactory.Parser |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of Position.
|
||||||
|
/// </summary>
|
||||||
|
public struct Location |
||||||
|
{ |
||||||
|
public static readonly Location Empty = new Location(0, 0); |
||||||
|
|
||||||
|
public Location(int column, int line) |
||||||
|
{ |
||||||
|
x = column; |
||||||
|
y = line; |
||||||
|
} |
||||||
|
|
||||||
|
int x, y; |
||||||
|
|
||||||
|
public int X { |
||||||
|
get { |
||||||
|
return x; |
||||||
|
} |
||||||
|
set { |
||||||
|
x = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public int Y { |
||||||
|
get { |
||||||
|
return y; |
||||||
|
} |
||||||
|
set { |
||||||
|
y = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public bool IsEmpty { |
||||||
|
get { |
||||||
|
return x <= 0 && y <= 0; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue