From 99a3286f7207debee0c405e03af1528db490bca7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kon=C3=AD=C4=8Dek?= Date: Sat, 21 Aug 2010 00:51:31 +0000 Subject: [PATCH] Debugger visualizers are loaded from AddInTree. NullReferenceException fix in GenerateCode context action. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6430 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Debugger.AddIn/Debugger.AddIn.addin | 17 ++++++++++++----- .../Debugger.AddIn/Debugger.AddIn.csproj | 2 +- ...dDescriptor.cs => IVisualizerDescriptor.cs} | 0 .../Commands/VisualizerDescriptors.cs | 18 +++++++----------- .../Project/Src/GenerateCode.cs | 2 +- .../ContextActionsBulbControl.xaml | 2 +- 6 files changed, 22 insertions(+), 19 deletions(-) rename src/AddIns/Debugger/Debugger.AddIn/Visualizers/Commands/{IVisualizerCommandDescriptor.cs => IVisualizerDescriptor.cs} (100%) diff --git a/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.addin b/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.addin index b56f9770cd..2c1cdb0d2e 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.addin +++ b/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.addin @@ -25,8 +25,8 @@ class="ICSharpCode.SharpDevelop.Services.WindowsDebugger"/> - - + + - + @@ -152,10 +152,17 @@ class = "ICSharpCode.SharpDevelop.Gui.OptionPanels.DebuggingSymbolsPanel"/> - + + type="ComboBox" id="SelectLanguageCommand" /> + + + + + + + diff --git a/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.csproj b/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.csproj index b7f88aca22..28d50e5915 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.csproj +++ b/src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.csproj @@ -138,7 +138,7 @@ - + diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Commands/IVisualizerCommandDescriptor.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Commands/IVisualizerDescriptor.cs similarity index 100% rename from src/AddIns/Debugger/Debugger.AddIn/Visualizers/Commands/IVisualizerCommandDescriptor.cs rename to src/AddIns/Debugger/Debugger.AddIn/Visualizers/Commands/IVisualizerDescriptor.cs diff --git a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Commands/VisualizerDescriptors.cs b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Commands/VisualizerDescriptors.cs index ffbfefaf63..32550c828f 100644 --- a/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Commands/VisualizerDescriptors.cs +++ b/src/AddIns/Debugger/Debugger.AddIn/Visualizers/Commands/VisualizerDescriptors.cs @@ -9,6 +9,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; +using ICSharpCode.Core; namespace Debugger.AddIn.Visualizers { @@ -17,23 +18,18 @@ namespace Debugger.AddIn.Visualizers /// public static class VisualizerDescriptors { - static ReadOnlyCollection allDescriptors; - - static IEnumerable CreateAllDescriptors() + static IList CreateAllDescriptors() { - // these should be obtained from AddIn tree so that it is possible to write add-in for Debugger.AddIn with new visualizers - yield return new TextVisualizerDescriptor(); - yield return new XmlVisualizerDescriptor(); - yield return new ObjectGraphVisualizerDescriptor(); - yield return new GridVisualizerDescriptor(); + return AddInTree.BuildItems("/SharpDevelop/Services/DebuggerService/Visualizers", null); } + static ReadOnlyCollection descriptors; public static ReadOnlyCollection GetAllDescriptors() { - if (allDescriptors == null) { - allDescriptors = CreateAllDescriptors().ToList().AsReadOnly(); + if (descriptors == null) { + descriptors = CreateAllDescriptors().ToList().AsReadOnly(); } - return allDescriptors; + return descriptors; } } } diff --git a/src/AddIns/Misc/SharpRefactoring/Project/Src/GenerateCode.cs b/src/AddIns/Misc/SharpRefactoring/Project/Src/GenerateCode.cs index 5f49d27125..cabd458272 100644 --- a/src/AddIns/Misc/SharpRefactoring/Project/Src/GenerateCode.cs +++ b/src/AddIns/Misc/SharpRefactoring/Project/Src/GenerateCode.cs @@ -44,7 +44,7 @@ namespace SharpRefactoring } catch (FormatException) { } - if (unknownMethodCall.Target.IsUserCode()) { + if (unknownMethodCall.Target != null && unknownMethodCall.Target.IsUserCode()) { // Don't introduce method on non-modyfiable types return new IntroduceMethodContextAction(unknownMethodCall, expression, context.Editor) { Title = title diff --git a/src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsBulbControl.xaml b/src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsBulbControl.xaml index 9e0696a63c..6ae2741ad8 100644 --- a/src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsBulbControl.xaml +++ b/src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsBulbControl.xaml @@ -236,7 +236,7 @@ - +