Browse Source

Fixed SD2-405: Invisible menu item can be run by shortcut.

Fixed SD2-376: Debugger: Menu consistency.
Added caching to SearchClassReturnType (dramatically improves code completion performance in classes that have many base types like XmlView).

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@336 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 21 years ago
parent
commit
83d7b3301e
  1. 107
      AddIns/ICSharpCode.SharpDevelop.addin
  2. 2
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/FormDesignerSecondaryDisplayBinding.cs
  3. 23
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlView.cs
  4. 5
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.addin
  5. 36
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs
  6. 4
      src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj
  7. 13
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/TextBufferStrategy/GapTextBufferStrategy.cs
  8. 1
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  9. 9
      src/Main/Base/Project/Src/Dom/Implementations/SearchClassReturnType.cs
  10. 15
      src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/ClassBrowser.cs
  11. 25
      src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs
  12. 31
      src/Main/Base/Project/Src/Internal/ConditionEvaluators/DebuggerSupportsEvaluator.cs
  13. 80
      src/Main/Base/Project/Src/Services/Debugger/DebuggerDoozer.cs
  14. 32
      src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs
  15. 36
      src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs
  16. 45
      src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs
  17. 17
      src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs
  18. 8
      src/Main/Base/Project/Src/Services/ParserService/IProjectContent.cs
  19. 14
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/MenuItem/Gui/MenuCommand.cs
  20. 1
      src/Main/Core/Project/Src/Services/ToolBarService/ToolBarService.cs
  21. 1
      src/Main/StartUp/Project/SharpDevelopMain.cs

107
AddIns/ICSharpCode.SharpDevelop.addin

@ -714,64 +714,77 @@ @@ -714,64 +714,77 @@
<ToolbarItem id = "DebuggerSeparator" type = "Separator" />
<Condition name="DebuggerSupports" debuggersupports = "Start">
<Condition name="IsProcessRunning" isdebugging="False" action="Disable">
<ToolbarItem id = "Run"
icon = "Icons.16x16.RunProgramIcon"
tooltip = "${res:XML.MainMenu.RunMenu.Run.Description}"
class = "ICSharpCode.SharpDevelop.Project.Commands.Execute"/>
<ComplexCondition>
<Or>
<Condition name="IsProcessRunning" isdebugging = "False"/>
<Not>
<Condition name="DebuggerSupports" debuggersupports = "ExecutionControl"/>
</Not>
</Or>
<Condition name="IsProcessRunning" isdebugging = "False" action = "Disable">
<Condition name="DebuggerSupports" debuggersupports = "Start">
<ToolbarItem id = "Run"
icon = "Icons.16x16.RunProgramIcon"
tooltip = "${res:XML.MainMenu.RunMenu.Run.Description}"
class = "ICSharpCode.SharpDevelop.Project.Commands.Execute"/>
</Condition>
<Condition name="DebuggerSupports" debuggersupports = "StartWithoutDebugging">
<ToolbarItem id = "RunWithoutDebugger"
icon = "Icons.16x16.Debug.StartWithoutDebugging"
tooltip = "${res:XML.MainMenu.DebugMenu.RunWithoutDebug.Description}"
class = "ICSharpCode.SharpDevelop.Project.Commands.ExecuteWithoutDebugger"/>
</Condition>
</Condition>
</Condition>
</ComplexCondition>
<Condition name="DebuggerSupports" debuggersupports = "StartWithoutDebugging">
<Condition name="IsProcessRunning" isdebugging="False" action="Disable">
<ToolbarItem id = "RunWithoutDebugger"
icon = "Icons.16x16.Debug.StartWithoutDebugging"
tooltip = "${res:XML.MainMenu.DebugMenu.RunWithoutDebug.Description}"
class = "ICSharpCode.SharpDevelop.Project.Commands.ExecuteWithoutDebugger"/>
<Condition name="IsProcessRunning" isdebugging = "True">
<Condition name="DebuggerSupports" debuggersupports = "ExecutionControl">
<Condition name="IsProcessRunning" isprocessrunning = "False" action = "Disable">
<ToolbarItem id = "Continue"
icon = "Icons.16x16.Debug.Continue"
tooltip = "${res:XML.MainMenu.DebugMenu.Continue.Description}"
class = "ICSharpCode.SharpDevelop.Project.Commands.ContinueDebuggingCommand"/>
</Condition>
<Condition name="IsProcessRunning" isprocessrunning = "True" action = "Disable">
<ToolbarItem id = "Break"
icon = "Icons.16x16.Debug.Break"
tooltip = "${res:XML.MainMenu.DebugMenu.Break.Description}"
class = "ICSharpCode.SharpDevelop.Project.Commands.BreakDebuggingCommand"/>
</Condition>
</Condition>
</Condition>
<Condition name="DebuggerSupports" debuggersupports = "Stop">
<Condition name="IsProcessRunning" isdebugging="True" action="Disable">
<ComplexCondition action = "Disable">
<Or>
<Condition name="IsProcessRunning" isdebugging = "True"/>
<Condition name="IsProcessRunning" isprocessrunning = "True"/>
</Or>
<ToolbarItem id = "Stop"
icon = "Icons.16x16.StopProcess"
tooltip = "${res:XML.MainMenu.DebugMenu.Stop.Description}"
class = "ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand"/>
</Condition>
</ComplexCondition>
</Condition>
<Condition name="DebuggerSupports" debuggersupports = "ExecutionControl">
<ToolbarItem id = "ExecutionControlSeparator" type = "Separator" />
<Condition name="IsProcessRunning" isprocessrunning = "True" isdebugging = "True" action = "Disable">
<ToolbarItem id = "Break"
icon = "Icons.16x16.Debug.Break"
tooltip = "Break the debugging process"
class = "ICSharpCode.SharpDevelop.Project.Commands.BreakDebuggingCommand"/>
</Condition>
<Condition name="IsProcessRunning" isprocessrunning = "False" isdebugging = "True" action = "Disable">
<ToolbarItem id = "Continue"
icon = "Icons.16x16.Debug.Continue"
tooltip = "${res:XML.MainMenu.DebugMenu.Continue.Description}"
class = "ICSharpCode.SharpDevelop.Project.Commands.ContinueDebuggingCommand"/>
</Condition>
</Condition>
<Condition name="DebuggerSupports" debuggersupports = "Stepping">
<Condition name="IsProcessRunning" isprocessrunning = "False" isdebugging = "True" action = "Disable">
<ToolbarItem id = "SteppingSeparator" type = "Separator" />
<ToolbarItem id = "Step over"
icon = "Icons.16x16.Debug.StepOver"
tooltip = "Step over"
class = "ICSharpCode.SharpDevelop.Project.Commands.StepDebuggingCommand"/>
<ToolbarItem id = "Step into"
icon = "Icons.16x16.Debug.StepInto"
tooltip = "Step into"
class = "ICSharpCode.SharpDevelop.Project.Commands.StepIntoDebuggingCommand"/>
<ToolbarItem id = "Step out"
icon = "Icons.16x16.Debug.StepOut"
tooltip = "Step out"
class = "ICSharpCode.SharpDevelop.Project.Commands.StepOutDebuggingCommand"/>
<Condition name="IsProcessRunning" isdebugging = "True">
<Condition name="DebuggerSupports" debuggersupports = "Stepping">
<Condition name="IsProcessRunning" isprocessrunning = "False" action = "Disable">
<ToolbarItem id = "SteppingSeparator" type = "Separator" />
<ToolbarItem id = "Step over"
icon = "Icons.16x16.Debug.StepOver"
tooltip = "Step over"
class = "ICSharpCode.SharpDevelop.Project.Commands.StepDebuggingCommand"/>
<ToolbarItem id = "Step into"
icon = "Icons.16x16.Debug.StepInto"
tooltip = "Step into"
class = "ICSharpCode.SharpDevelop.Project.Commands.StepIntoDebuggingCommand"/>
<ToolbarItem id = "Step out"
icon = "Icons.16x16.Debug.StepOut"
tooltip = "Step out"
class = "ICSharpCode.SharpDevelop.Project.Commands.StepOutDebuggingCommand"/>
</Condition>
</Condition>
</Condition>
@ -1225,7 +1238,7 @@ @@ -1225,7 +1238,7 @@
<MenuItem id = "ExecutionControlSeparator" type = "Separator" />
<Condition name="IsProcessRunning" isprocessrunning = "True" isdebugging = "True" action = "Disable">
<MenuItem id = "Break"
label = "Break"
label = "${res:XML.MainMenu.DebugMenu.Break}"
icon = "Icons.16x16.Debug.Break"
shortcut = "Control|Alt|B"
class = "ICSharpCode.SharpDevelop.Project.Commands.BreakDebuggingCommand"/>

2
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/FormDesignerSecondaryDisplayBinding.cs

@ -60,7 +60,7 @@ namespace ICSharpCode.FormDesigner @@ -60,7 +60,7 @@ namespace ICSharpCode.FormDesigner
{
// Simple test for fully qualified name
foreach (IReturnType baseType in c.BaseTypes) {
if (baseType.Name == "System.Windows.Forms.Form" || baseType.Name == "System.Windows.Forms.UserControl") {
if (baseType.FullyQualifiedName == "System.Windows.Forms.Form" || baseType.FullyQualifiedName == "System.Windows.Forms.UserControl") {
return true;
}
}

23
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlView.cs

@ -196,12 +196,31 @@ namespace ICSharpCode.XmlEditor @@ -196,12 +196,31 @@ namespace ICSharpCode.XmlEditor
}
}
// ParserUpdateThread uses the text property via IEditable, I had an exception
// because multiple threads were accessing the GapBufferStrategy at the same time.
string GetText()
{
return xmlEditor.Document.TextContent;
}
void SetText(string value)
{
xmlEditor.Document.TextContent = value;
}
public string Text {
get {
return xmlEditor.Document.TextContent;
if (WorkbenchSingleton.InvokeRequired)
return (string)WorkbenchSingleton.SafeThreadCall(this, "GetText", null);
else
return GetText();
}
set {
xmlEditor.Document.TextContent = value;
if (WorkbenchSingleton.InvokeRequired)
WorkbenchSingleton.SafeThreadCall(this, "SetText", value);
else
SetText(value);
}
}

5
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Debugger.AddIn.addin

@ -4,7 +4,10 @@ @@ -4,7 +4,10 @@
</Runtime>
<Path name="/SharpDevelop/Services/DebuggerService/Debugger">
<Class id="DefaultDebugger" class="ICSharpCode.SharpDevelop.Services.WindowsDebugger"/>
<Debugger id="DefaultDebugger"
supportsStepping = "true"
supportsExecutionControl = "true"
class="ICSharpCode.SharpDevelop.Services.WindowsDebugger"/>
</Path>
<!--<Path name = "/SharpDevelop/Workbench/MainMenu/Debug">

36
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Service/WindowsDebugger.cs

@ -102,36 +102,15 @@ namespace ICSharpCode.SharpDevelop.Services @@ -102,36 +102,15 @@ namespace ICSharpCode.SharpDevelop.Services
processStartInfo.Arguments);
}
public bool SupportsStart {
get {
return true;
}
}
public void StartWithoutDebugging(ProcessStartInfo processStartInfo)
{
System.Diagnostics.Process process;
process = new System.Diagnostics.Process();
process.StartInfo = processStartInfo;
process.Start();
}
public bool SupportsStartWithoutDebugging {
get {
return true;
}
System.Diagnostics.Process.Start(processStartInfo);
}
public void Stop()
{
debugger.Terminate();
}
public bool SupportsStop {
get {
return true;
}
}
// ExecutionControl:
@ -145,12 +124,6 @@ namespace ICSharpCode.SharpDevelop.Services @@ -145,12 +124,6 @@ namespace ICSharpCode.SharpDevelop.Services
debugger.Continue();
}
public bool SupportsExecutionControl {
get {
return true;
}
}
// Stepping:
public void StepInto()
@ -180,12 +153,6 @@ namespace ICSharpCode.SharpDevelop.Services @@ -180,12 +153,6 @@ namespace ICSharpCode.SharpDevelop.Services
}
}
public bool SupportsStepping {
get {
return true;
}
}
public event EventHandler DebugStarted;
protected virtual void OnDebugStarted(EventArgs e)
@ -352,6 +319,7 @@ namespace ICSharpCode.SharpDevelop.Services @@ -352,6 +319,7 @@ namespace ICSharpCode.SharpDevelop.Services
exceptionHistory.Clear();
OnDebugStopped(EventArgs.Empty);
isDebuggingCache = false;
isProcessRunningCache = false;
}
}

4
src/Libraries/ICSharpCode.TextEditor/Project/ICSharpCode.TextEditor.csproj

@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<OutputPath>..\..\..\..\bin\</OutputPath>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
<DefineConstants>DEBUG</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>False</DebugSymbols>
@ -181,4 +181,4 @@ @@ -181,4 +181,4 @@
<Compile Include="Src\Document\TextBufferStrategy\PieceTableTextBufferStrategy.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>
</Project>

13
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/TextBufferStrategy/GapTextBufferStrategy.cs

@ -12,6 +12,16 @@ namespace ICSharpCode.TextEditor.Document @@ -12,6 +12,16 @@ namespace ICSharpCode.TextEditor.Document
{
public class GapTextBufferStrategy : ITextBufferStrategy
{
#if DEBUG
int creatorThread = System.Threading.Thread.CurrentThread.ManagedThreadId;
void CheckThread()
{
if (System.Threading.Thread.CurrentThread.ManagedThreadId != creatorThread)
throw new InvalidOperationException("GapTextBufferStategy is not thread-safe!");
}
#endif
char[] buffer = new char[0];
int gapBeginOffset = 0;
@ -48,6 +58,9 @@ namespace ICSharpCode.TextEditor.Document @@ -48,6 +58,9 @@ namespace ICSharpCode.TextEditor.Document
public string GetText(int offset, int length)
{
#if DEBUG
CheckThread();
#endif
int end = offset + length;
if (end < gapBeginOffset) {

1
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -689,6 +689,7 @@ @@ -689,6 +689,7 @@
<Compile Include="Src\TextEditor\SearchAndReplace\Engine\SearchStrategy\BoyerMooreSearchStrategy.cs" />
<Compile Include="Src\Gui\BrowserDisplayBinding\BrowserCommands.cs" />
<Compile Include="Src\Gui\BrowserDisplayBinding\BrowserLocationConditionEvaluator.cs" />
<Compile Include="Src\Services\Debugger\DebuggerDoozer.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Libraries\DockPanel_Src\WinFormsUI\WinFormsUI.csproj">

9
src/Main/Base/Project/Src/Dom/Implementations/SearchClassReturnType.cs

@ -59,16 +59,21 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -59,16 +59,21 @@ namespace ICSharpCode.SharpDevelop.Dom
return declaringClass.GetHashCode() ^ name.GetHashCode();
}
// TODO: Cache BaseType until a new CompilationUnit is generated (static counter in ParserService)
bool isSearching;
IReturnType cachedBaseType;
int cachedVersion = -1;
public override IReturnType BaseType {
get {
if (isSearching)
return null;
if (pc.Version == cachedVersion)
return cachedBaseType;
try {
isSearching = true;
return pc.SearchType(name, declaringClass, caretLine, caretColumn);
cachedBaseType = pc.SearchType(name, declaringClass, caretLine, caretColumn);
cachedVersion = pc.Version;
return cachedBaseType;
} finally {
isSearching = false;
}

15
src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/ClassBrowser.cs

@ -75,19 +75,8 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -75,19 +75,8 @@ namespace ICSharpCode.SharpDevelop.Gui
void UpdateToolbars()
{
foreach (object o in toolStrip.Items) {
if (o is IStatusUpdate) {
((IStatusUpdate)o).UpdateStatus();
}
}
toolStrip.Refresh();
foreach (object o in searchStrip.Items) {
if (o is IStatusUpdate) {
((IStatusUpdate)o).UpdateStatus();
}
}
searchStrip.Refresh();
ToolbarService.UpdateToolbar(toolStrip);
ToolbarService.UpdateToolbar(searchStrip);
}
public ClassBrowser()

25
src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs

@ -469,37 +469,16 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -469,37 +469,16 @@ namespace ICSharpCode.SharpDevelop.Gui
void UpdateToolbars()
{
if (ToolBars != null) {
foreach (ToolStrip ToolStrip in ToolBars) {
bool doRefresh = false;
foreach (ToolStripItem item in ToolStrip.Items) {
bool wasVisible = item.Visible;
if (item is ToolBarCommand) {
ToolBarCommand toolBarCommand = (ToolBarCommand)item;
doRefresh |= toolBarCommand.LastEnabledStatus != toolBarCommand.CurrentEnableStatus;
toolBarCommand.UpdateStatus();
} else {
if (item is IStatusUpdate) {
((IStatusUpdate)item).UpdateStatus();
}
}
doRefresh |= wasVisible != item.Visible;
}
if (doRefresh) {
ToolStrip.Refresh();
}
foreach (ToolStrip toolStrip in ToolBars) {
ToolbarService.UpdateToolbar(toolStrip);
}
}
}
// this method simply copies over the enabled state of the toolbar,
// this assumes that no item is inserted or removed.
// TODO : make this method more add-in tree like, currently with Windows.Forms
// toolbars this is not possible. (drawing fragments, slow etc.)
void CreateToolBars()
{
if (ToolBars == null) {
ToolBars = ToolbarService.CreateToolbars(this, "/SharpDevelop/Workbench/ToolBar");
UpdateToolbars();
}
}

31
src/Main/Base/Project/Src/Internal/ConditionEvaluators/DebuggerSupportsEvaluator.cs

@ -16,24 +16,21 @@ namespace ICSharpCode.Core @@ -16,24 +16,21 @@ namespace ICSharpCode.Core
{
public bool IsValid(object caller, Condition condition)
{
IDebugger debugger = DebuggerService.IsDebuggerLoaded ? DebuggerService.CurrentDebugger : new DefaultDebugger();
if (debugger != null) {
switch (condition.Properties["debuggersupports"]) {
case "Start":
return debugger.SupportsStart;
case "StartWithoutDebugging":
return debugger.SupportsStartWithoutDebugging;
case "Stop":
return debugger.SupportsStop;
case "ExecutionControl":
return debugger.SupportsExecutionControl;
case "Stepping":
return debugger.SupportsStepping;
default:
throw new ArgumentException("Unknown debugger support for : >" + condition.Properties["debuggersupports"] + "< please fix addin file.", "debuggersupports");
}
DebuggerDescriptor debugger = DebuggerService.Descriptor;
switch (condition.Properties["debuggersupports"]) {
case "Start":
return (debugger != null) ? debugger.SupportsStart : true;
case "StartWithoutDebugging":
return (debugger != null) ? debugger.SupportsStartWithoutDebugging : true;
case "Stop":
return (debugger != null) ? debugger.SupportsStop : true;
case "ExecutionControl":
return (debugger != null) ? debugger.SupportsExecutionControl : false;
case "Stepping":
return (debugger != null) ? debugger.SupportsStepping : false;
default:
throw new ArgumentException("Unknown debugger support for : >" + condition.Properties["debuggersupports"] + "< please fix addin file.", "debuggersupports");
}
return false;
}
}
}

80
src/Main/Base/Project/Src/Services/Debugger/DebuggerDoozer.cs

@ -0,0 +1,80 @@ @@ -0,0 +1,80 @@
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Collections;
namespace ICSharpCode.Core
{
public class DebuggerDoozer : IDoozer
{
/// <summary>
/// Gets if the doozer handles codon conditions on its own.
/// If this property return false, the item is excluded when the condition is not met.
/// </summary>
public bool HandleConditions {
get {
return false;
}
}
public object BuildItem(object caller, Codon codon, ArrayList subItems)
{
return new DebuggerDescriptor(codon);
}
}
public class DebuggerDescriptor
{
Codon codon;
public DebuggerDescriptor(Codon codon)
{
this.codon = codon;
}
IDebugger debugger;
public IDebugger Debugger {
get {
if (debugger == null)
debugger = (IDebugger)codon.AddIn.CreateObject(codon.Properties["class"]);
return debugger;
}
}
public bool SupportsStart {
get {
return codon.Properties["supportsStart"] != "false";
}
}
public bool SupportsStartWithoutDebugging {
get {
return codon.Properties["supportsStartWithoutDebugger"] != "false";
}
}
public bool SupportsStop {
get {
return codon.Properties["supportsStop"] != "false";
}
}
public bool SupportsStepping {
get {
return codon.Properties["supportsStepping"] == "true";
}
}
public bool SupportsExecutionControl {
get {
return codon.Properties["supportsExecutionControl"] == "true";
}
}
}
}

32
src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs

@ -26,7 +26,7 @@ namespace ICSharpCode.Core @@ -26,7 +26,7 @@ namespace ICSharpCode.Core
public static class DebuggerService
{
static IDebugger currentDebugger;
static ArrayList debuggers;
static DebuggerDescriptor[] debuggers;
static string oldLayoutConfiguration = "Default";
static DebuggerService()
@ -40,18 +40,23 @@ namespace ICSharpCode.Core @@ -40,18 +40,23 @@ namespace ICSharpCode.Core
BM.BookmarkManager.Removed += BookmarkRemoved;
}
static void GetDescriptors()
{
if (debuggers == null) {
debuggers = (DebuggerDescriptor[])AddInTree.BuildItems("/SharpDevelop/Services/DebuggerService/Debugger", null, false).ToArray(typeof(DebuggerDescriptor));
}
}
static IDebugger GetCompatibleDebugger()
{
GetDescriptors();
IProject project = null;
if (ProjectService.OpenSolution != null) {
project = ProjectService.OpenSolution.StartupProject;
}
if (debuggers == null) {
debuggers = AddInTree.BuildItems("/SharpDevelop/Services/DebuggerService/Debugger", null, false);
}
foreach (IDebugger d in debuggers) {
if (d.CanDebug(project)) {
return d;
foreach (DebuggerDescriptor d in debuggers) {
if (d.Debugger.CanDebug(project)) {
return d.Debugger;
}
}
return new DefaultDebugger();
@ -59,8 +64,8 @@ namespace ICSharpCode.Core @@ -59,8 +64,8 @@ namespace ICSharpCode.Core
/// <summary>
/// Gets the current debugger. The debugger addin is loaded on demand; so if you
/// just want to check a property like IsDebugging, use <see cref="LoadedDebugger"/>
/// instead.
/// just want to check a property like IsDebugging, check <see cref="IsDebuggerLoaded"/>
/// before using this property.
/// </summary>
public static IDebugger CurrentDebugger {
get {
@ -73,6 +78,15 @@ namespace ICSharpCode.Core @@ -73,6 +78,15 @@ namespace ICSharpCode.Core
}
}
public static DebuggerDescriptor Descriptor {
get {
GetDescriptors();
if (debuggers.Length > 0)
return debuggers[0];
return null;
}
}
/// <summary>
/// Returns true if debugger is already loaded.
/// </summary>

36
src/Main/Base/Project/Src/Services/Debugger/DefaultDebugger.cs

@ -61,24 +61,9 @@ namespace ICSharpCode.Core @@ -61,24 +61,9 @@ namespace ICSharpCode.Core
OnDebugStopped(EventArgs.Empty);
}
public bool SupportsStart {
get {
return true;
}
}
public void StartWithoutDebugging(ProcessStartInfo processStartInfo)
{
Process process;
process = new Process();
process.StartInfo = processStartInfo;
process.Start();
}
public bool SupportsStartWithoutDebugging {
get {
return true;
}
Process.Start(processStartInfo);
}
public void Stop()
@ -91,12 +76,6 @@ namespace ICSharpCode.Core @@ -91,12 +76,6 @@ namespace ICSharpCode.Core
attachedProcess = null;
}
}
public bool SupportsStop {
get {
return true;
}
}
// ExecutionControl:
@ -109,13 +88,6 @@ namespace ICSharpCode.Core @@ -109,13 +88,6 @@ namespace ICSharpCode.Core
{
throw new NotSupportedException();
}
public bool SupportsExecutionControl {
get {
return false;
}
}
// Stepping:
public void StepInto()
@ -133,12 +105,6 @@ namespace ICSharpCode.Core @@ -133,12 +105,6 @@ namespace ICSharpCode.Core
throw new NotSupportedException();
}
public bool SupportsStepping {
get {
return false;
}
}
public event EventHandler DebugStarted;
protected virtual void OnDebugStarted(EventArgs e)

45
src/Main/Base/Project/Src/Services/Debugger/IDebugger.cs

@ -9,7 +9,7 @@ using System; @@ -9,7 +9,7 @@ using System;
using ICSharpCode.SharpDevelop.Project;
using System.Diagnostics;
namespace ICSharpCode.Core
namespace ICSharpCode.Core
{
public interface IDebugger : IDisposable
{
@ -29,71 +29,48 @@ namespace ICSharpCode.Core @@ -29,71 +29,48 @@ namespace ICSharpCode.Core
}
bool CanDebug(IProject project);
/// <summary>
/// Starts process and attaches debugger
/// </summary>
void Start(ProcessStartInfo processStartInfo);
bool SupportsStart {
get;
}
/// <summary>
/// Starts process and does not attach debugger
/// </summary>
void StartWithoutDebugging(ProcessStartInfo processStartInfo);
bool SupportsStartWithoutDebugging {
get;
}
/// <summary>
/// Stops/terminates attached process
/// </summary>
void Stop();
bool SupportsStop {
get;
}
// ExecutionControl:
void Break();
void Continue();
bool SupportsExecutionControl {
get;
}
// Stepping:
void StepInto();
void StepOver();
void StepOut();
bool SupportsStepping {
get;
}
/// <summary>
/// Gets the current value of the variable as string that can be displayed in tooltips.
/// </summary>
string GetValueAsString(string variable);
/// <summary>
/// Ocurrs after the debugger has started.
/// </summary>
event EventHandler DebugStarted;
/// <summary>
/// Ocurrs when the value of IsProcessRunning changes.
/// </summary>
event EventHandler IsProcessRunningChanged;
/// <summary>
/// Ocurrs after the debugging of program is finished.
/// </summary>

17
src/Main/Base/Project/Src/Services/ParserService/DefaultProjectContent.cs

@ -37,6 +37,21 @@ namespace ICSharpCode.Core @@ -37,6 +37,21 @@ namespace ICSharpCode.Core
List<Dictionary<string, NamespaceStruct>> namespaces = new List<Dictionary<string, NamespaceStruct>>();
protected XmlDoc xmlDoc = new XmlDoc();
IUsing defaultImports;
int version;
public int Version {
get {
return version;
}
}
void IncrementVersion()
{
if (version == int.MaxValue)
version = 1;
else
version += 1;
}
public IUsing DefaultImports {
get {
@ -190,6 +205,7 @@ namespace ICSharpCode.Core @@ -190,6 +205,7 @@ namespace ICSharpCode.Core
public void AddClassToNamespaceList(IClass addClass)
{
IncrementVersion();
lock (namespaces) {
AddClassToNamespaceListInternal(addClass);
}
@ -303,6 +319,7 @@ namespace ICSharpCode.Core @@ -303,6 +319,7 @@ namespace ICSharpCode.Core
public void UpdateCompilationUnit(ICompilationUnit oldUnit, ICompilationUnit parserOutput, string fileName, bool updateCommentTags)
{
IncrementVersion();
if (updateCommentTags) {
TaskService.UpdateCommentTags(fileName, parserOutput.TagComments);
}

8
src/Main/Base/Project/Src/Services/ParserService/IProjectContent.cs

@ -55,6 +55,14 @@ namespace ICSharpCode.Core @@ -55,6 +55,14 @@ namespace ICSharpCode.Core
get;
}
/// <summary>
/// Gets the version number of the project content.
/// Is incremented whenever a CompilationUnit is updated.
/// </summary>
int Version {
get;
}
string GetXmlDocumentation(string memberTag);
void AddClassToNamespaceList(IClass addClass);

14
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/MenuItem/Gui/MenuCommand.cs

@ -109,8 +109,10 @@ namespace ICSharpCode.Core @@ -109,8 +109,10 @@ namespace ICSharpCode.Core
protected override void OnClick(System.EventArgs e)
{
base.OnClick(e);
if (codon != null) {
Command.Run();
if (GetVisible() && Enabled) {
if (codon != null) {
Command.Run();
}
}
}
@ -136,14 +138,18 @@ namespace ICSharpCode.Core @@ -136,14 +138,18 @@ namespace ICSharpCode.Core
}
}
bool GetVisible()
{
return codon.GetFailedAction(caller) != ConditionFailedAction.Exclude;
}
public virtual void UpdateStatus()
{
if (codon != null) {
if (Image == null && codon.Properties.Contains("icon")) {
Image = ResourceService.GetBitmap(codon.Properties["icon"]);
}
ConditionFailedAction failedAction = codon.GetFailedAction(caller);
Visible = failedAction != ConditionFailedAction.Exclude;
Visible = GetVisible();
if (localizedText == null) {
localizedText = codon.Properties["label"];

1
src/Main/Core/Project/Src/Services/ToolBarService/ToolBarService.cs

@ -70,6 +70,7 @@ namespace ICSharpCode.Core @@ -70,6 +70,7 @@ namespace ICSharpCode.Core
((IStatusUpdate)item).UpdateStatus();
}
}
toolStrip.Refresh();
}
}
}

1
src/Main/StartUp/Project/SharpDevelopMain.cs

@ -168,6 +168,7 @@ namespace ICSharpCode.SharpDevelop @@ -168,6 +168,7 @@ namespace ICSharpCode.SharpDevelop
AddInTree.Doozers.Add("SyntaxMode", new ICSharpCode.SharpDevelop.DefaultEditor.Codons.SyntaxModeDoozer());
AddInTree.Doozers.Add("BrowserSchemeExtension", new ICSharpCode.SharpDevelop.BrowserDisplayBinding.SchemeExtensionDoozer());
AddInTree.Doozers.Add("CodeCompletionBinding", new ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.CodeCompletionBindingDoozer());
AddInTree.Doozers.Add("Debugger", new DebuggerDoozer());
MenuCommand.LinkCommandCreator = delegate(string link) { return new LinkCommand(link); };

Loading…
Cancel
Save