Browse Source

Fixed SD2-1382 (Exception when double-clicking control with existing event handler). The AbstractDesignerGenerator passed the wrong document to GetCursorLine when the open file was not the designer file.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3277 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Christian Hornung 18 years ago
parent
commit
e108656912
  1. 14
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs

14
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/AbstractDesignerGenerator.cs

@ -14,14 +14,15 @@ using System.ComponentModel; @@ -14,14 +14,15 @@ using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Reflection;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Refactoring;
using ICSharpCode.TextEditor;
using ICSharpCode.TextEditor.Document;
using SearchAndReplace;
using ReflectionLayer = ICSharpCode.SharpDevelop.Dom.ReflectionLayer;
namespace ICSharpCode.FormsDesigner
@ -387,8 +388,17 @@ namespace ICSharpCode.FormsDesigner @@ -387,8 +388,17 @@ namespace ICSharpCode.FormsDesigner
foreach (IMethod method in completeClass.Methods) {
if (method.Name == eventMethodName) {
position = GetCursorLine(document, method);
file = method.DeclaringType.CompilationUnit.FileName;
if (FileUtility.IsEqualFileName(file, this.designerFile)) {
position = GetCursorLine(document, method);
} else {
try {
position = GetCursorLine(FindReferencesAndRenameHelper.GetDocumentInformation(file).CreateDocument(), method);
} catch (FileNotFoundException) {
position = 0;
return false;
}
}
return true;
}
}

Loading…
Cancel
Save