From eb0a071dc2944dbe7f79b0d77c0d03a0be098253 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Tue, 3 Oct 2006 18:09:07 +0000 Subject: [PATCH] Fixed SD2-1145: Delegates defined outside any class makes refactoring show "Move class to file ''" item. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1876 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs b/src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs index 94112294d7..01039acc9c 100644 --- a/src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs +++ b/src/Main/Base/Project/Src/TextEditor/Commands/ClassBookmarkMenuBuilder.cs @@ -49,6 +49,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands if (!FindReferencesAndRenameHelper.IsReadOnly(c)) { if (c.DeclaringType == null && + !c.BodyRegion.IsEmpty && !c.Name.Equals(Path.GetFileNameWithoutExtension(c.CompilationUnit.FileName), StringComparison.InvariantCultureIgnoreCase)) { @@ -131,8 +132,8 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands static string ExtractCode(IClass c, DomRegion codeRegion, int indentationLine) { ICSharpCode.TextEditor.Document.IDocument doc = GetDocument(c); - if (indentationLine < 0) indentationLine = 0; - if (indentationLine >= doc.TotalNumberOfLines) indentationLine = doc.TotalNumberOfLines - 1; + if (indentationLine < 1) indentationLine = 1; + if (indentationLine >= doc.TotalNumberOfLines) indentationLine = doc.TotalNumberOfLines; LineSegment segment = doc.GetLineSegment(indentationLine - 1); string mainLine = doc.GetText(segment);