public windowTerminalGTK(clsHost host) : base(String.Format("{0} - {1}:{2}",host.Name,host.RemoteHost,host.RemoteSSHPort)) { SSH = new clsSSHTerminal(host); Host = host; ScrolledWindow scrolledWindow = new ScrolledWindow(); textview1 = new TextView(); this.SetSizeRequest(800,600); scrolledWindow.Add(textview1); textview1.ModifyFont(FontDescription.FromString(host.TerminalFont)); this.Add(scrolledWindow); this.CanFocus = true; ShowAll (); SSH.TerminalData += (string text) => { Gtk.Application.Invoke (delegate { TextIter mIter = textview1.Buffer.EndIter; textview1.Buffer.Insert(ref mIter, text); textview1.ScrollToIter(textview1.Buffer.EndIter, 0, false, 0, 0); }); }; }
public windowTerminalVTE(clsHost host) : base(String.Format("{0} - {1}:{2}",host.Name,host.RemoteHost,host.RemoteSSHPort)) { SSH = new clsSSHTerminal(host); Host = host; HBox hbox = new HBox (); term = new Terminal (); term.CursorBlinks = true; term.MouseAutohide = false; term.ScrollOnKeystroke = true; term.DeleteBinding = TerminalEraseBinding.Auto; term.BackspaceBinding = TerminalEraseBinding.Auto; term.FontFromString = host.TerminalFont; term.Emulation = "xterm"; term.Encoding = "UTF-8"; term.SetSize(host.TerminalCols,host.TerminalRows); VScrollbar vscroll = new VScrollbar (term.Adjustment); hbox.PackStart (term); hbox.PackStart (vscroll); this.CanFocus = true; this.Add (hbox); ShowAll (); SSH.TerminalData += (string text) => { Gtk.Application.Invoke (delegate { term.Feed(text); }); }; }
public windowTerminalGTK(clsHost host) : base(String.Format("{0} - {1}:{2}", host.Name, host.RemoteHost, host.RemoteSSHPort)) { SSH = new clsSSHTerminal(host); Host = host; ScrolledWindow scrolledWindow = new ScrolledWindow(); textview1 = new TextView(); this.SetSizeRequest(800, 600); scrolledWindow.Add(textview1); textview1.ModifyFont(FontDescription.FromString(host.TerminalFont)); this.Add(scrolledWindow); this.CanFocus = true; ShowAll(); SSH.TerminalData += (string text) => { Gtk.Application.Invoke(delegate { TextIter mIter = textview1.Buffer.EndIter; textview1.Buffer.Insert(ref mIter, text); textview1.ScrollToIter(textview1.Buffer.EndIter, 0, false, 0, 0); }); }; }
//TODO: dropdown menus for picking string substitutions. also substitutions for port, ip public clsDebuggerOptionsDialog() : base( "SSH Debug", MonoDevelop.Ide.MessageService.RootWindow, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal) { properties = PropertyService.Get("MonoDevelop.Debugger.Soft.SSHDebug", new Properties()); AddActionWidget(connectButton, connectResponse); AddActionWidget(newButton, newResponse); AddActionWidget(new Gtk.Button(Gtk.Stock.Cancel), Gtk.ResponseType.Cancel); var table = new Gtk.Table(1, 2, false); table.BorderWidth = 6; VBox.PackStart(table, true, true, 0); table.Attach(new Gtk.Label("Host") { Xalign = 0 }, 0, 1, 0, 1); var values = clsSSHDebuggerEngine.HostsList.Select(x => String.Format("{0} ({1})", x.Name, System.IO.Path.GetFileName(x.ScriptPath))).ToArray(); combo = new Gtk.ComboBox(values); int row = 0; if (clsSSHDebuggerEngine.HostsList.Count == 0) { connectButton.Sensitive = false; } else { var lastSelected = clsSSHDebuggerEngine.HostsList.Find(x => x.ScriptPath == properties.Get <string> ("host", "")); if (lastSelected != null) { row = clsSSHDebuggerEngine.HostsList.IndexOf(lastSelected); if (row == -1) { row = 0; } } Gtk.TreeIter iter; combo.Model.IterNthChild(out iter, row); combo.SetActiveIter(iter); SelectedHost = clsSSHDebuggerEngine.HostsList [combo.Active]; combo.Changed += (object sender, EventArgs e) => { SelectedHost = clsSSHDebuggerEngine.HostsList [combo.Active]; }; } table.Attach(combo, 1, 2, 0, 1); VBox.ShowAll(); }
clsHost GetDebuggerInfo() { ResponseType response; String filepath = null; clsHost selectedHost = null; try { using (var dlg = new clsDebuggerOptionsDialog()) { response = (Gtk.ResponseType)dlg.Run(); if (dlg.SelectedHost != null) { filepath = dlg.SelectedHost.ScriptPath; selectedHost = dlg.SelectedHost; } dlg.Destroy(); } while (GLib.MainContext.Iteration()) { ; } if (response == Gtk.ResponseType.Accept) { Gtk.Application.Invoke(delegate { using (var md = new MessageDialog(null, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, "Please add a ssh template file manually to your project")) { md.Run(); md.Destroy(); } }); return(null); } else if (response != Gtk.ResponseType.Ok) { return(null); } var properties = PropertyService.Get("MonoDevelop.Debugger.Soft.SSHDebug", new Properties()); properties.Set("host", filepath); return(selectedHost); } catch (Exception ex) { Gtk.Application.Invoke(delegate { using (var md = new MessageDialog(null, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, ex.Message)) { md.Title = "SoftDebuggerStartInfo"; md.Run(); md.Destroy(); } }); return(null); } }
public windowTerminalVTE(clsHost host) : base(String.Format("{0} - {1}:{2}", host.Name, host.RemoteHost, host.RemoteSSHPort)) { SSH = new clsSSHTerminal(host); Host = host; HBox hbox = new HBox(); term = new Terminal(); term.CursorBlinks = true; term.MouseAutohide = false; term.ScrollOnKeystroke = true; term.DeleteBinding = TerminalEraseBinding.Auto; term.BackspaceBinding = TerminalEraseBinding.Auto; term.FontFromString = host.TerminalFont; term.Emulation = "xterm"; term.Encoding = "UTF-8"; term.SetSize(host.TerminalCols, host.TerminalRows); VScrollbar vscroll = new VScrollbar(term.Adjustment); hbox.PackStart(term); hbox.PackStart(vscroll); this.CanFocus = true; this.Add(hbox); ShowAll(); SSH.TerminalData += (string text) => { Gtk.Application.Invoke(delegate { term.Feed(text); }); }; }
public clsSSHTerminal(clsHost host) { Host = host; AddDefaultPrivateKey (); }
public void SetHost(clsHost host) { Host = host; }
public clsSSHTerminal(clsHost host) { Host = host; AddDefaultPrivateKey(); }
//TODO: dropdown menus for picking string substitutions. also substitutions for port, ip public clsDebuggerOptionsDialog() : base("SSH Debug", MonoDevelop.Ide.MessageService.RootWindow, Gtk.DialogFlags.DestroyWithParent | Gtk.DialogFlags.Modal) { properties = PropertyService.Get ("MonoDevelop.Debugger.Soft.SSHDebug", new Properties()); AddActionWidget (connectButton, connectResponse); AddActionWidget (newButton, newResponse); AddActionWidget (new Gtk.Button (Gtk.Stock.Cancel), Gtk.ResponseType.Cancel); var table = new Gtk.Table (1, 2, false); table.BorderWidth = 6; VBox.PackStart (table, true, true, 0); table.Attach (new Gtk.Label ("Host") { Xalign = 0 }, 0, 1, 0, 1); var values = clsSSHDebuggerEngine.HostsList.Select (x => String.Format ("{0} ({1})", x.Name, System.IO.Path.GetFileName (x.ScriptPath))).ToArray (); combo = new Gtk.ComboBox (values); int row=0; if (clsSSHDebuggerEngine.HostsList.Count == 0) { connectButton.Sensitive = false; } else { var lastSelected = clsSSHDebuggerEngine.HostsList.Find (x => x.ScriptPath == properties.Get<string> ("host", "")); if (lastSelected != null) { row = clsSSHDebuggerEngine.HostsList.IndexOf (lastSelected); if (row == -1) row = 0; } Gtk.TreeIter iter; combo.Model.IterNthChild (out iter, row); combo.SetActiveIter (iter); SelectedHost = clsSSHDebuggerEngine.HostsList [combo.Active]; combo.Changed += (object sender, EventArgs e) => { SelectedHost = clsSSHDebuggerEngine.HostsList [combo.Active]; }; } table.Attach (combo, 1, 2, 0, 1); VBox.ShowAll (); }
public override DebuggerStartInfo CreateDebuggerStartInfo(ExecutionCommand c) { SoftDebuggerStartInfo dsi = null; try{ //If new host, no host is selected, or ther terminal window is closed if (BuildList() || selectedHost == null || selectedHost.Terminal == null) { //Load any new templates selectedHost = InvokeSynch <clsHost> (GetDebuggerInfo); //Query user for selected host } if (selectedHost != null) { if (selectedHost.Terminal == null) { #if VTE selectedHost.Terminal = new windowTerminalVTE(selectedHost); #else selectedHost.Terminal = new windowTerminalGTK(selectedHost); #endif } else { selectedHost.Terminal.Front(); } var done = new ManualResetEvent(false); Task.Run(() => { dsi = selectedHost.ProcessScript(true); }).ContinueWith((t) => { done.Set(); }); while (true) { Gtk.Application.RunIteration(); if (done.WaitOne(0)) { break; } } } if (dsi != null) { selectedHost.Terminal.SSH.WriteLine("Starting debugger"); } return(dsi); } catch (ThreadAbortException) //User closed terminal (probably) { return(null); } catch (Exception ex) { Gtk.Application.Invoke(delegate { using (var md = new MessageDialog(null, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, "Terminal error " + ex.Message)) { md.Run(); md.Destroy(); } }); return(null); } }