diff --git a/bin/setup/PostInstallTasks.bat b/bin/setup/PostInstallTasks.bat index 03c331045e..e84352df19 100644 --- a/bin/setup/PostInstallTasks.bat +++ b/bin/setup/PostInstallTasks.bat @@ -4,9 +4,6 @@ echo. echo NUnit.Framework.dll ..\tools\gacutil2.exe /i ..\nunit.framework.dll echo. -echo ICSharpCode.SharpZipLib.dll -..\tools\gacutil2.exe /i ..\ICSharpCode.SharpZipLib.dll -echo. echo MbUnit requirements ..\tools\gacutil2.exe /i ..\tools\MbUnit\Refly.dll ..\tools\gacutil2.exe /i ..\tools\MbUnit\TestFu.dll diff --git a/bin/setup/PreUninstallTasks.bat b/bin/setup/PreUninstallTasks.bat index 0f38d8d1d5..24a7f2fb40 100644 --- a/bin/setup/PreUninstallTasks.bat +++ b/bin/setup/PreUninstallTasks.bat @@ -3,8 +3,6 @@ echo Removing assemblies from the GAC echo. ..\tools\gacutil2.exe /u ..\nunit.framework.dll echo. -..\tools\gacutil2.exe /u ..\ICSharpCode.SharpZipLib.dll -echo. ..\tools\gacutil2.exe /u ..\tools\MbUnit\Refly.dll ..\tools\gacutil2.exe /u ..\tools\MbUnit\TestFu.dll ..\tools\gacutil2.exe /u ..\tools\MbUnit\QuickGraph.dll diff --git a/data/resources/layouts/Default.xml b/data/resources/layouts/Default.xml index 9808666681..44ec956d79 100644 Binary files a/data/resources/layouts/Default.xml and b/data/resources/layouts/Default.xml differ diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/EventHandlerCompletitionDataProvider.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/EventHandlerCompletitionDataProvider.cs index 8cec11e81f..13acc7987b 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/EventHandlerCompletitionDataProvider.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/EventHandlerCompletitionDataProvider.cs @@ -8,6 +8,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Text; using System.Windows.Forms; using ICSharpCode.TextEditor; using ICSharpCode.Core; @@ -24,11 +25,13 @@ namespace CSharpBinding { string expression; ResolveResult resolveResult; + IClass resolvedClass; public EventHandlerCompletitionDataProvider(string expression, ResolveResult resolveResult) { this.expression = expression; this.resolveResult = resolveResult; + this.resolvedClass = resolveResult.ResolvedType.GetUnderlyingClass(); } /// @@ -37,8 +40,82 @@ namespace CSharpBinding public override ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped) { ArrayList completionData = new ArrayList(); - completionData.Add(new DefaultCompletionData("new " + resolveResult.ResolvedType.FullyQualifiedName + "()", "Event handler", ClassBrowserIconService.DelegateIndex)); + completionData.Add(new DelegateCompletionData("new " + resolveResult.ResolvedType.Name + "();", 2, + "delegate " + resolvedClass.FullyQualifiedName + "\n" + CodeCompletionData.GetDocumentation(resolvedClass.Documentation))); + completionData.Add(new DelegateCompletionData("delegate { };", 3, + "${res:CSharpBinding.InsertAnonymousMethod}")); + CSharpAmbience ambience = new CSharpAmbience(); + ambience.ConversionFlags = ConversionFlags.ShowParameterNames; + IMethod invoke = resolvedClass.SearchMember("Invoke", LanguageProperties.CSharp) as IMethod; + if (invoke != null) { + StringBuilder builder = new StringBuilder("delegate("); + for (int i = 0; i < invoke.Parameters.Count; ++i) { + if (i > 0) { + builder.Append(", "); + } + builder.Append(ambience.Convert(invoke.Parameters[i])); + } + builder.Append(") { };"); + completionData.Add(new DelegateCompletionData(builder.ToString(), 3, + "${res:CSharpBinding.InsertAnonymousMethodWithParameters}")); + IClass callingClass = resolveResult.CallingClass; + IClass eventReturnType = invoke.ReturnType.GetUnderlyingClass(); + IClass[] eventParameters = new IClass[invoke.Parameters.Count]; + for (int i = 0; i < eventParameters.Length; i++) { + eventParameters[i] = invoke.Parameters[i].ReturnType.GetUnderlyingClass(); + if (eventParameters[i] == null) { + eventReturnType = null; + break; + } + } + if (callingClass != null && eventReturnType != null) { + bool inStatic = false; + if (resolveResult.CallingMember != null) + inStatic = resolveResult.CallingMember.IsStatic; + foreach (IMethod method in callingClass.DefaultReturnType.GetMethods()) { + if (inStatic && !method.IsStatic) + continue; + if (!method.IsAccessible(callingClass, true)) + continue; + if (method.Parameters.Count != invoke.Parameters.Count) + continue; + // check return type compatibility: + IClass c2 = method.ReturnType.GetUnderlyingClass(); + if (c2 == null || !c2.IsTypeInInheritanceTree(eventReturnType)) + continue; + bool ok = true; + for (int i = 0; i < eventParameters.Length; i++) { + c2 = method.Parameters[i].ReturnType.GetUnderlyingClass(); + if (c2 == null || !eventParameters[i].IsTypeInInheritanceTree(c2)) { + ok = false; + break; + } + } + if (ok) { + completionData.Add(new CodeCompletionData(method)); + } + } + } + } return (ICompletionData[])completionData.ToArray(typeof(ICompletionData)); } + + private class DelegateCompletionData : DefaultCompletionData + { + int cursorOffset; + + public DelegateCompletionData(string text, int cursorOffset, string documentation) + : base(text, StringParser.Parse(documentation), ClassBrowserIconService.DelegateIndex) + { + this.cursorOffset = cursorOffset; + } + + public override bool InsertAction(TextArea textArea, char ch) + { + bool r = base.InsertAction(textArea, ch); + textArea.Caret.Column -= cursorOffset; + return r; + } + } } } diff --git a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/ICompletionData.cs b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/ICompletionData.cs index 04e2f0c53f..ceccece234 100644 --- a/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/ICompletionData.cs +++ b/src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/CompletionWindow/ICompletionData.cs @@ -88,7 +88,7 @@ namespace ICSharpCode.TextEditor.Gui.CompletionWindow } } - public bool InsertAction(TextArea textArea, char ch) + public virtual bool InsertAction(TextArea textArea, char ch) { textArea.InsertString(text); return false; diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj index 164cc84506..eca6beeac6 100644 --- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj +++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj @@ -30,10 +30,6 @@ 4 - - ..\RequiredLibraries\ICSharpCode.SharpZipLib.dll - False - diff --git a/src/Main/Base/RequiredLibraries/ICSharpCode.SharpZipLib.dll b/src/Main/Base/RequiredLibraries/ICSharpCode.SharpZipLib.dll deleted file mode 100644 index d4f6275f62..0000000000 Binary files a/src/Main/Base/RequiredLibraries/ICSharpCode.SharpZipLib.dll and /dev/null differ diff --git a/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs b/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs index bd476424d0..330c36fc19 100644 --- a/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs +++ b/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs @@ -116,7 +116,7 @@ namespace ICSharpCode.SharpDevelop void CloseButtonClick(object sender, EventArgs e) { - if (MessageService.AskQuestion("Do you really want to quit SharpDevelop?")) { + if (MessageBox.Show("Do you really want to quit SharpDevelop?", "SharpDevelop", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { Application.Exit(); } } diff --git a/src/Tools/Tools.build b/src/Tools/Tools.build index 6fd0cd947a..bf8f4b5322 100644 --- a/src/Tools/Tools.build +++ b/src/Tools/Tools.build @@ -10,9 +10,6 @@ - - - @@ -25,7 +22,6 @@ --> -