diff --git a/src/Main/Base/Project/Src/Gui/Components/FontSelectionPanel.cs b/src/Main/Base/Project/Src/Gui/Components/FontSelectionPanel.cs
index d49acb9ff8..ccad2d521c 100644
--- a/src/Main/Base/Project/Src/Gui/Components/FontSelectionPanel.cs
+++ b/src/Main/Base/Project/Src/Gui/Components/FontSelectionPanel.cs
@@ -24,7 +24,11 @@ namespace ICSharpCode.SharpDevelop.Gui
{
public string CurrentFontString {
get {
- return CurrentFont.ToString();
+ Font font = CurrentFont;
+ if (font != null)
+ return font.ToString();
+ else
+ return null;
}
set {
CurrentFont = FontSelectionPanel.ParseFont(value);
diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/OutputWindowOptionsPanel.cs b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/OutputWindowOptionsPanel.cs
index 1f3eb24e2d..6860282bd1 100644
--- a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/OutputWindowOptionsPanel.cs
+++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/OutputWindowOptionsPanel.cs
@@ -40,7 +40,9 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
{
Properties properties = (Properties)PropertyService.Get(OutputWindowsProperty, new Properties());
properties.Set("WordWrap", ((CheckBox)ControlDictionary["wordWrapCheckBox"]).Checked);
- properties.Set("DefaultFont", fontSelectionPanel.CurrentFontString);
+ string currentFontString = fontSelectionPanel.CurrentFontString;
+ if (currentFontString != null)
+ properties.Set("DefaultFont", currentFontString);
PropertyService.Set(OutputWindowsProperty, properties);
return true;
diff --git a/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs b/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs
index 553cb58fbb..7d7bde1aae 100644
--- a/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs
+++ b/src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs
@@ -6,6 +6,7 @@
//
using System;
+using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
using System.Drawing;
@@ -27,11 +28,19 @@ namespace ICSharpCode.SharpDevelop.Refactoring
/// The base class.
/// The project contents in which derived classes should be searched.
/// If true, gets only the classes that derive directly from .
- public static List FindDerivedClasses(IClass baseClass, IEnumerable projectContents, bool directDerivationOnly)
+ public static IEnumerable FindDerivedClasses(IClass baseClass, IEnumerable projectContents, bool directDerivationOnly)
+ {
+ HashSet resultList = new HashSet();
+ FindDerivedClasses(resultList, baseClass, projectContents, directDerivationOnly);
+ return resultList.OrderBy(c => c.FullyQualifiedName);
+ }
+
+ static void FindDerivedClasses(HashSet resultList, IClass baseClass, IEnumerable projectContents, bool directDerivationOnly)
{
baseClass = baseClass.GetCompoundClass();
string baseClassName = baseClass.Name;
string baseClassFullName = baseClass.FullyQualifiedName;
+ LoggingService.Debug("FindDerivedClasses for " + baseClassFullName);
List list = new List();
foreach (IProjectContent pc in projectContents) {
if (pc != baseClass.ProjectContent && !pc.ReferencedContents.Contains(baseClass.ProjectContent)) {
@@ -41,17 +50,15 @@ namespace ICSharpCode.SharpDevelop.Refactoring
}
AddDerivedClasses(pc, baseClass, baseClassName, baseClassFullName, pc.Classes, list);
}
- if (!directDerivationOnly) {
- List additional = new List();
+ if (directDerivationOnly) {
+ resultList.AddRange(list);
+ } else {
foreach (IClass c in list) {
- additional.AddRange(FindDerivedClasses(c, projectContents, directDerivationOnly));
- }
- foreach (IClass c in additional) {
- if (!list.Contains(c))
- list.Add(c);
+ if (resultList.Add(c)) {
+ FindDerivedClasses(resultList, c, projectContents, directDerivationOnly);
+ }
}
}
- return list;
}
static void AddDerivedClasses(IProjectContent pc, IClass baseClass, string baseClassName, string baseClassFullName,
@@ -65,7 +72,9 @@ namespace ICSharpCode.SharpDevelop.Refactoring
if (pc.Language.NameComparer.Equals(baseTypeName, baseClassName) ||
pc.Language.NameComparer.Equals(baseTypeName, baseClassFullName)) {
IReturnType possibleBaseClass = c.GetBaseType(i);
- if (possibleBaseClass.FullyQualifiedName == baseClass.FullyQualifiedName) {
+ if (possibleBaseClass.FullyQualifiedName == baseClass.FullyQualifiedName
+ && possibleBaseClass.TypeArgumentCount == baseClass.TypeParameters.Count)
+ {
resultList.Add(c);
}
}
@@ -425,5 +434,3 @@ namespace ICSharpCode.SharpDevelop.Refactoring
#endregion
}
}
-
-
diff --git a/src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs b/src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs
index db8707272f..e11cf79be8 100644
--- a/src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs
+++ b/src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs
@@ -344,14 +344,14 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
{
MenuCommand item = (MenuCommand)sender;
IClass c = (IClass)item.Tag;
- List derivedClasses = RefactoringService.FindDerivedClasses(c, ParserService.AllProjectContents, false);
+ IEnumerable derivedClasses = RefactoringService.FindDerivedClasses(c, ParserService.AllProjectContents, false);
List results = new List();
foreach (IClass derivedClass in derivedClasses) {
if (derivedClass.CompilationUnit == null) continue;
if (derivedClass.CompilationUnit.FileName == null) continue;
- SearchResultMatch res = new SimpleSearchResultMatch(derivedClass.FullyQualifiedName, new TextLocation(derivedClass.Region.BeginColumn - 1, derivedClass.Region.BeginLine - 1));
+ SearchResultMatch res = new SimpleSearchResultMatch(ClassNode.GetText(derivedClass), new TextLocation(derivedClass.Region.BeginColumn - 1, derivedClass.Region.BeginLine - 1));
res.ProvidedDocumentInformation = FindReferencesAndRenameHelper.GetDocumentInformation(derivedClass.CompilationUnit.FileName);
results.Add(res);
}
diff --git a/src/Main/Base/Project/Src/TextEditor/Commands/ClassMemberMenuBuilder.cs b/src/Main/Base/Project/Src/TextEditor/Commands/ClassMemberMenuBuilder.cs
index dd08af783b..d5c0bc51dc 100644
--- a/src/Main/Base/Project/Src/TextEditor/Commands/ClassMemberMenuBuilder.cs
+++ b/src/Main/Base/Project/Src/TextEditor/Commands/ClassMemberMenuBuilder.cs
@@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Drawing;
using System.Windows.Forms;
@@ -176,14 +177,14 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
{
MenuCommand item = (MenuCommand)sender;
IMember member = (IMember)item.Tag;
- List derivedClasses = RefactoringService.FindDerivedClasses(member.DeclaringType, ParserService.AllProjectContents, false);
+ IEnumerable derivedClasses = RefactoringService.FindDerivedClasses(member.DeclaringType, ParserService.AllProjectContents, false);
List results = new List();
foreach (IClass derivedClass in derivedClasses) {
if (derivedClass.CompilationUnit == null) continue;
if (derivedClass.CompilationUnit.FileName == null) continue;
IMember m = MemberLookupHelper.FindSimilarMember(derivedClass, member);
if (m != null && !m.Region.IsEmpty) {
- SearchResultMatch res = new SimpleSearchResultMatch(m.FullyQualifiedName, new TextLocation(m.Region.BeginColumn - 1, m.Region.BeginLine - 1));
+ SearchResultMatch res = new SimpleSearchResultMatch(MemberNode.GetText(m), new TextLocation(m.Region.BeginColumn - 1, m.Region.BeginLine - 1));
res.ProvidedDocumentInformation = FindReferencesAndRenameHelper.GetDocumentInformation(derivedClass.CompilationUnit.FileName);
results.Add(res);
}