public void Execute(object sender, EventArgs args) { var dte2 = (DTE2)Package.GetGlobalService(typeof(SDTE)); if (dte2 != null && dte2.ActiveDocument != null) { var launcher = new PowerShellProjectLauncher(); launcher.LaunchFile(dte2.ActiveDocument.FullName, true); } }
public virtual void Execute(object sender, EventArgs args) { var dte2 = (DTE2)Package.GetGlobalService(typeof(SDTE)); var launcher = new PowerShellProjectLauncher(_validator.Validate()); var file = GetTargetFile(dte2); if (String.IsNullOrEmpty(file)) { return; } Utilities.SaveDirtyFiles(); launcher.LaunchFile(file, true, ScriptArgs != null ? ScriptArgs.ScriptArgs : null); }
public void Execute(object sender, EventArgs args) { var dte2 = (DTE2)Package.GetGlobalService(typeof(SDTE)); if (dte2 != null && dte2.ActiveDocument != null) { var launcher = new PowerShellProjectLauncher(); TextSelection sel = (TextSelection)dte2.ActiveDocument.Selection; if (sel.TopPoint.EqualTo(sel.ActivePoint)) { sel.SelectLine(); launcher.LaunchSelection(sel.Text); } else { launcher.LaunchSelection(sel.Text); } } }
public void Execute(object sender, EventArgs args) { var dte2 = (DTE2)Package.GetGlobalService(typeof(SDTE)); var launcher = new PowerShellProjectLauncher(_validator.Validate()); var file = GetTargetFile(dte2); if (String.IsNullOrEmpty(file)) { return; } Utilities.SaveDirtyFiles(); TextSelection selection = (TextSelection)dte2.ActiveDocument.Selection; // If the selection is completely empty, selected current line and run that. if (string.IsNullOrEmpty(selection.Text)) { selection.SelectLine(); } launcher.LaunchSelection(selection.Text); }