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. 57
      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. 2
      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. 15
      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. 23
      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. 10
      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

57
AddIns/ICSharpCode.SharpDevelop.addin

@ -714,51 +714,63 @@
<ToolbarItem id = "DebuggerSeparator" type = "Separator" /> <ToolbarItem id = "DebuggerSeparator" type = "Separator" />
<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"> <Condition name="DebuggerSupports" debuggersupports = "Start">
<Condition name="IsProcessRunning" isdebugging="False" action="Disable">
<ToolbarItem id = "Run" <ToolbarItem id = "Run"
icon = "Icons.16x16.RunProgramIcon" icon = "Icons.16x16.RunProgramIcon"
tooltip = "${res:XML.MainMenu.RunMenu.Run.Description}" tooltip = "${res:XML.MainMenu.RunMenu.Run.Description}"
class = "ICSharpCode.SharpDevelop.Project.Commands.Execute"/> class = "ICSharpCode.SharpDevelop.Project.Commands.Execute"/>
</Condition> </Condition>
</Condition>
<Condition name="DebuggerSupports" debuggersupports = "StartWithoutDebugging"> <Condition name="DebuggerSupports" debuggersupports = "StartWithoutDebugging">
<Condition name="IsProcessRunning" isdebugging="False" action="Disable">
<ToolbarItem id = "RunWithoutDebugger" <ToolbarItem id = "RunWithoutDebugger"
icon = "Icons.16x16.Debug.StartWithoutDebugging" icon = "Icons.16x16.Debug.StartWithoutDebugging"
tooltip = "${res:XML.MainMenu.DebugMenu.RunWithoutDebug.Description}" tooltip = "${res:XML.MainMenu.DebugMenu.RunWithoutDebug.Description}"
class = "ICSharpCode.SharpDevelop.Project.Commands.ExecuteWithoutDebugger"/> class = "ICSharpCode.SharpDevelop.Project.Commands.ExecuteWithoutDebugger"/>
</Condition> </Condition>
</Condition> </Condition>
</ComplexCondition>
<Condition name="DebuggerSupports" debuggersupports = "Stop"> <Condition name="IsProcessRunning" isdebugging = "True">
<Condition name="IsProcessRunning" isdebugging="True" action="Disable">
<ToolbarItem id = "Stop"
icon = "Icons.16x16.StopProcess"
tooltip = "${res:XML.MainMenu.DebugMenu.Stop.Description}"
class = "ICSharpCode.SharpDevelop.Project.Commands.StopDebuggingCommand"/>
</Condition>
</Condition>
<Condition name="DebuggerSupports" debuggersupports = "ExecutionControl"> <Condition name="DebuggerSupports" debuggersupports = "ExecutionControl">
<ToolbarItem id = "ExecutionControlSeparator" type = "Separator" /> <Condition name="IsProcessRunning" isprocessrunning = "False" action = "Disable">
<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" <ToolbarItem id = "Continue"
icon = "Icons.16x16.Debug.Continue" icon = "Icons.16x16.Debug.Continue"
tooltip = "${res:XML.MainMenu.DebugMenu.Continue.Description}" tooltip = "${res:XML.MainMenu.DebugMenu.Continue.Description}"
class = "ICSharpCode.SharpDevelop.Project.Commands.ContinueDebuggingCommand"/> class = "ICSharpCode.SharpDevelop.Project.Commands.ContinueDebuggingCommand"/>
</Condition> </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>
<Condition name="DebuggerSupports" debuggersupports = "Stop">
<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"/>
</ComplexCondition>
</Condition>
<Condition name="IsProcessRunning" isdebugging = "True">
<Condition name="DebuggerSupports" debuggersupports = "Stepping"> <Condition name="DebuggerSupports" debuggersupports = "Stepping">
<Condition name="IsProcessRunning" isprocessrunning = "False" isdebugging = "True" action = "Disable"> <Condition name="IsProcessRunning" isprocessrunning = "False" action = "Disable">
<ToolbarItem id = "SteppingSeparator" type = "Separator" /> <ToolbarItem id = "SteppingSeparator" type = "Separator" />
<ToolbarItem id = "Step over" <ToolbarItem id = "Step over"
icon = "Icons.16x16.Debug.StepOver" icon = "Icons.16x16.Debug.StepOver"
@ -774,6 +786,7 @@
class = "ICSharpCode.SharpDevelop.Project.Commands.StepOutDebuggingCommand"/> class = "ICSharpCode.SharpDevelop.Project.Commands.StepOutDebuggingCommand"/>
</Condition> </Condition>
</Condition> </Condition>
</Condition>
<ToolbarItem id = "ChooseConfigurationSeparator" type = "Separator"/> <ToolbarItem id = "ChooseConfigurationSeparator" type = "Separator"/>
</ComplexCondition> </ComplexCondition>
@ -1225,7 +1238,7 @@
<MenuItem id = "ExecutionControlSeparator" type = "Separator" /> <MenuItem id = "ExecutionControlSeparator" type = "Separator" />
<Condition name="IsProcessRunning" isprocessrunning = "True" isdebugging = "True" action = "Disable"> <Condition name="IsProcessRunning" isprocessrunning = "True" isdebugging = "True" action = "Disable">
<MenuItem id = "Break" <MenuItem id = "Break"
label = "Break" label = "${res:XML.MainMenu.DebugMenu.Break}"
icon = "Icons.16x16.Debug.Break" icon = "Icons.16x16.Debug.Break"
shortcut = "Control|Alt|B" shortcut = "Control|Alt|B"
class = "ICSharpCode.SharpDevelop.Project.Commands.BreakDebuggingCommand"/> class = "ICSharpCode.SharpDevelop.Project.Commands.BreakDebuggingCommand"/>

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

@ -60,7 +60,7 @@ namespace ICSharpCode.FormDesigner
{ {
// Simple test for fully qualified name // Simple test for fully qualified name
foreach (IReturnType baseType in c.BaseTypes) { 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; return true;
} }
} }

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

@ -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 { public string Text {
get { get {
return xmlEditor.Document.TextContent; if (WorkbenchSingleton.InvokeRequired)
return (string)WorkbenchSingleton.SafeThreadCall(this, "GetText", null);
else
return GetText();
} }
set { 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 @@
</Runtime> </Runtime>
<Path name="/SharpDevelop/Services/DebuggerService/Debugger"> <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>
<!--<Path name = "/SharpDevelop/Workbench/MainMenu/Debug"> <!--<Path name = "/SharpDevelop/Workbench/MainMenu/Debug">

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

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

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

@ -22,7 +22,7 @@
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> <CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
<OutputPath>..\..\..\..\bin\</OutputPath> <OutputPath>..\..\..\..\bin\</OutputPath>
<TreatWarningsAsErrors>False</TreatWarningsAsErrors> <DefineConstants>DEBUG</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>False</DebugSymbols> <DebugSymbols>False</DebugSymbols>

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

@ -12,6 +12,16 @@ namespace ICSharpCode.TextEditor.Document
{ {
public class GapTextBufferStrategy : ITextBufferStrategy 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]; char[] buffer = new char[0];
int gapBeginOffset = 0; int gapBeginOffset = 0;
@ -48,6 +58,9 @@ namespace ICSharpCode.TextEditor.Document
public string GetText(int offset, int length) public string GetText(int offset, int length)
{ {
#if DEBUG
CheckThread();
#endif
int end = offset + length; int end = offset + length;
if (end < gapBeginOffset) { if (end < gapBeginOffset) {

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

@ -689,6 +689,7 @@
<Compile Include="Src\TextEditor\SearchAndReplace\Engine\SearchStrategy\BoyerMooreSearchStrategy.cs" /> <Compile Include="Src\TextEditor\SearchAndReplace\Engine\SearchStrategy\BoyerMooreSearchStrategy.cs" />
<Compile Include="Src\Gui\BrowserDisplayBinding\BrowserCommands.cs" /> <Compile Include="Src\Gui\BrowserDisplayBinding\BrowserCommands.cs" />
<Compile Include="Src\Gui\BrowserDisplayBinding\BrowserLocationConditionEvaluator.cs" /> <Compile Include="Src\Gui\BrowserDisplayBinding\BrowserLocationConditionEvaluator.cs" />
<Compile Include="Src\Services\Debugger\DebuggerDoozer.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\Libraries\DockPanel_Src\WinFormsUI\WinFormsUI.csproj"> <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
return declaringClass.GetHashCode() ^ name.GetHashCode(); return declaringClass.GetHashCode() ^ name.GetHashCode();
} }
// TODO: Cache BaseType until a new CompilationUnit is generated (static counter in ParserService)
bool isSearching; bool isSearching;
IReturnType cachedBaseType;
int cachedVersion = -1;
public override IReturnType BaseType { public override IReturnType BaseType {
get { get {
if (isSearching) if (isSearching)
return null; return null;
if (pc.Version == cachedVersion)
return cachedBaseType;
try { try {
isSearching = true; isSearching = true;
return pc.SearchType(name, declaringClass, caretLine, caretColumn); cachedBaseType = pc.SearchType(name, declaringClass, caretLine, caretColumn);
cachedVersion = pc.Version;
return cachedBaseType;
} finally { } finally {
isSearching = false; isSearching = false;
} }

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

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

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

@ -469,37 +469,16 @@ namespace ICSharpCode.SharpDevelop.Gui
void UpdateToolbars() void UpdateToolbars()
{ {
if (ToolBars != null) { if (ToolBars != null) {
foreach (ToolStrip ToolStrip in ToolBars) { foreach (ToolStrip toolStrip in ToolBars) {
bool doRefresh = false; ToolbarService.UpdateToolbar(toolStrip);
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();
}
} }
} }
} }
// 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() void CreateToolBars()
{ {
if (ToolBars == null) { if (ToolBars == null) {
ToolBars = ToolbarService.CreateToolbars(this, "/SharpDevelop/Workbench/ToolBar"); ToolBars = ToolbarService.CreateToolbars(this, "/SharpDevelop/Workbench/ToolBar");
UpdateToolbars();
} }
} }

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

@ -16,24 +16,21 @@ namespace ICSharpCode.Core
{ {
public bool IsValid(object caller, Condition condition) public bool IsValid(object caller, Condition condition)
{ {
IDebugger debugger = DebuggerService.IsDebuggerLoaded ? DebuggerService.CurrentDebugger : new DefaultDebugger(); DebuggerDescriptor debugger = DebuggerService.Descriptor;
if (debugger != null) {
switch (condition.Properties["debuggersupports"]) { switch (condition.Properties["debuggersupports"]) {
case "Start": case "Start":
return debugger.SupportsStart; return (debugger != null) ? debugger.SupportsStart : true;
case "StartWithoutDebugging": case "StartWithoutDebugging":
return debugger.SupportsStartWithoutDebugging; return (debugger != null) ? debugger.SupportsStartWithoutDebugging : true;
case "Stop": case "Stop":
return debugger.SupportsStop; return (debugger != null) ? debugger.SupportsStop : true;
case "ExecutionControl": case "ExecutionControl":
return debugger.SupportsExecutionControl; return (debugger != null) ? debugger.SupportsExecutionControl : false;
case "Stepping": case "Stepping":
return debugger.SupportsStepping; return (debugger != null) ? debugger.SupportsStepping : false;
default: default:
throw new ArgumentException("Unknown debugger support for : >" + condition.Properties["debuggersupports"] + "< please fix addin file.", "debuggersupports"); 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 @@
// <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
public static class DebuggerService public static class DebuggerService
{ {
static IDebugger currentDebugger; static IDebugger currentDebugger;
static ArrayList debuggers; static DebuggerDescriptor[] debuggers;
static string oldLayoutConfiguration = "Default"; static string oldLayoutConfiguration = "Default";
static DebuggerService() static DebuggerService()
@ -40,18 +40,23 @@ namespace ICSharpCode.Core
BM.BookmarkManager.Removed += BookmarkRemoved; 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() static IDebugger GetCompatibleDebugger()
{ {
GetDescriptors();
IProject project = null; IProject project = null;
if (ProjectService.OpenSolution != null) { if (ProjectService.OpenSolution != null) {
project = ProjectService.OpenSolution.StartupProject; project = ProjectService.OpenSolution.StartupProject;
} }
if (debuggers == null) { foreach (DebuggerDescriptor d in debuggers) {
debuggers = AddInTree.BuildItems("/SharpDevelop/Services/DebuggerService/Debugger", null, false); if (d.Debugger.CanDebug(project)) {
} return d.Debugger;
foreach (IDebugger d in debuggers) {
if (d.CanDebug(project)) {
return d;
} }
} }
return new DefaultDebugger(); return new DefaultDebugger();
@ -59,8 +64,8 @@ namespace ICSharpCode.Core
/// <summary> /// <summary>
/// Gets the current debugger. The debugger addin is loaded on demand; so if you /// 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"/> /// just want to check a property like IsDebugging, check <see cref="IsDebuggerLoaded"/>
/// instead. /// before using this property.
/// </summary> /// </summary>
public static IDebugger CurrentDebugger { public static IDebugger CurrentDebugger {
get { get {
@ -73,6 +78,15 @@ namespace ICSharpCode.Core
} }
} }
public static DebuggerDescriptor Descriptor {
get {
GetDescriptors();
if (debuggers.Length > 0)
return debuggers[0];
return null;
}
}
/// <summary> /// <summary>
/// Returns true if debugger is already loaded. /// Returns true if debugger is already loaded.
/// </summary> /// </summary>

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

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

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

@ -35,38 +35,19 @@ namespace ICSharpCode.Core
/// </summary> /// </summary>
void Start(ProcessStartInfo processStartInfo); void Start(ProcessStartInfo processStartInfo);
bool SupportsStart {
get;
}
/// <summary>
/// Starts process and does not attach debugger
/// </summary>
void StartWithoutDebugging(ProcessStartInfo processStartInfo); void StartWithoutDebugging(ProcessStartInfo processStartInfo);
bool SupportsStartWithoutDebugging {
get;
}
/// <summary> /// <summary>
/// Stops/terminates attached process /// Stops/terminates attached process
/// </summary> /// </summary>
void Stop(); void Stop();
bool SupportsStop {
get;
}
// ExecutionControl: // ExecutionControl:
void Break(); void Break();
void Continue(); void Continue();
bool SupportsExecutionControl {
get;
}
// Stepping: // Stepping:
void StepInto(); void StepInto();
@ -75,10 +56,6 @@ namespace ICSharpCode.Core
void StepOut(); void StepOut();
bool SupportsStepping {
get;
}
/// <summary> /// <summary>
/// Gets the current value of the variable as string that can be displayed in tooltips. /// Gets the current value of the variable as string that can be displayed in tooltips.
/// </summary> /// </summary>

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

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

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

@ -55,6 +55,14 @@ namespace ICSharpCode.Core
get; 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); string GetXmlDocumentation(string memberTag);
void AddClassToNamespaceList(IClass addClass); void AddClassToNamespaceList(IClass addClass);

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

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

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

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

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

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

Loading…
Cancel
Save