Browse Source

Added "Run" context menu item for custom assemblies in ClassBrowser.

newNRILSpyDebugger
Andreas Weizel 12 years ago
parent
commit
c2b0722922
  1. 9
      src/Main/Base/Project/ICSharpCode.SharpDevelop.addin
  2. 25
      src/Main/SharpDevelop/Dom/ClassBrowser/Commands.cs

9
src/Main/Base/Project/ICSharpCode.SharpDevelop.addin

@ -989,6 +989,15 @@
</Path> </Path>
<Path name = "/SharpDevelop/Pads/ClassBrowser/AssemblyContextMenu"> <Path name = "/SharpDevelop/Pads/ClassBrowser/AssemblyContextMenu">
<Condition name="IsProcessRunning" isdebugging = "False" action = "Exclude">
<Condition name="DebuggerSupports" debuggersupports = "Start">
<MenuItem id = "RunAssemblyWithDebugger"
label = "${res:XML.MainMenu.RunMenu.Run}"
icon = "Icons.16x16.RunProgramIcon"
class = "ICSharpCode.SharpDevelop.Dom.ClassBrowser.RunAssemblyWithDebuggerCommand"/>
<MenuItem id = "AssemblyContextMenuSeparator" type = "Separator"/>
</Condition>
</Condition>
<MenuItem id = "RemoveAssembly" <MenuItem id = "RemoveAssembly"
label = "Remove" label = "Remove"
icon = "Icons.16x16.DeleteIcon" icon = "Icons.16x16.DeleteIcon"

25
src/Main/SharpDevelop/Dom/ClassBrowser/Commands.cs

@ -2,8 +2,10 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System; using System;
using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using ICSharpCode.SharpDevelop.Debugging;
using Microsoft.Win32; using Microsoft.Win32;
namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser
@ -74,4 +76,27 @@ namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser
} }
} }
} }
/// <summary>
/// RunAssemblyWithDebuggerCommand.
/// </summary>
class RunAssemblyWithDebuggerCommand : SimpleCommand
{
public override bool CanExecute(object parameter)
{
IAssemblyModel assemblyModel = parameter as IAssemblyModel;
return (assemblyModel != null) && assemblyModel.Context.IsValid;
}
public override void Execute(object parameter)
{
IAssemblyModel assemblyModel = (IAssemblyModel) parameter;
// Start debugger with given assembly
DebuggerService.CurrentDebugger.Start(new ProcessStartInfo {
FileName = assemblyModel.Context.Location,
WorkingDirectory = Path.GetDirectoryName(assemblyModel.Context.Location)
});
}
}
} }

Loading…
Cancel
Save