From 91dec8424b0363e9a3f6492fb9aae13ce12454a2 Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Mon, 20 Feb 2006 16:22:21 +0000 Subject: [PATCH 01/10] Fixed SD2-695. Unsetting a breakpoint when viewing an xml document no longer leaves red text behind. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1169 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../XmlEditor/Project/Src/XmlEditorControl.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlEditorControl.cs b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlEditorControl.cs index 8999199b7f..eaa947ebba 100644 --- a/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlEditorControl.cs +++ b/src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlEditorControl.cs @@ -7,6 +7,7 @@ using ICSharpCode.Core; using ICSharpCode.SharpDevelop; +using ICSharpCode.SharpDevelop.Bookmarks; using ICSharpCode.SharpDevelop.DefaultEditor; using ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor; using ICSharpCode.SharpDevelop.Gui; @@ -41,6 +42,8 @@ namespace ICSharpCode.XmlEditor Document.FoldingManager.FoldingStrategy = new XmlFoldingStrategy(); TextEditorProperties = new SharpDevelopTextEditorProperties(); + Document.BookmarkManager.Removed += new ICSharpCode.TextEditor.Document.BookmarkEventHandler(BookmarkRemoved); + GenerateEditActions(); } @@ -324,5 +327,23 @@ namespace ICSharpCode.XmlEditor ActiveTextAreaControl.TextArea.MotherTextEditorControl.EndUpdate(); } + + /// + /// Have to remove the bookmark from the document otherwise the text will + /// stay marked in red if the bookmark is a breakpoint. This is because + /// there are two bookmark managers, one in SharpDevelop itself and one + /// in the TextEditor library. By default, only the one in the text editor's + /// bookmark manager will be removed, so SharpDevelop will not know about it. + /// Removing it from the SharpDevelop BookMarkManager informs the debugger + /// service that the breakpoint has been removed so it triggers the removal + /// of the text marker. + /// + void BookmarkRemoved(object sender, ICSharpCode.TextEditor.Document.BookmarkEventArgs e) + { + ICSharpCode.SharpDevelop.Bookmarks.SDBookmark b = e.Bookmark as ICSharpCode.SharpDevelop.Bookmarks.SDBookmark; + if (b != null) { + ICSharpCode.SharpDevelop.Bookmarks.BookmarkManager.RemoveMark(b); + } + } } } From af3c2e2d765db3037d5171557791588f9d3100df Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Tue, 21 Feb 2006 18:28:32 +0000 Subject: [PATCH 02/10] SD2-693 - ToolstripContainer designer loading problem. Applied Christian Hornung's patch that adds a Deselecting event handler for the IBaseViewContent interface, which is called before the view has been deselected, allowing the forms designer to read the correct ToolStripPanelVisible properties before the designed form is hidden. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1172 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/DesignerViewContent.cs | 6 +-- .../Src/Gui/AbstractBaseViewContent.cs | 4 ++ .../Base/Project/Src/Gui/IBaseViewContent.cs | 6 +++ .../Workbench/Layouts/SdiWorkspaceWindow.cs | 46 ++++++++++++------- 4 files changed, 42 insertions(+), 20 deletions(-) diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs index e89daaecb0..1292f5c7c7 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs @@ -347,17 +347,17 @@ namespace ICSharpCode.FormsDesigner { disposing = true; if (IsFormsDesignerVisible) { - Deselected(); + Deselecting(); } base.Dispose(); } - public override void Deselected() + public override void Deselecting() { // can happen if form designer is disposed and then deselected if (!IsFormsDesignerVisible) return; - LoggingService.Info("Deselected form designer, unloading..." + viewContent.TitleName); + LoggingService.Info("Deselecting form designer, unloading..." + viewContent.TitleName); PropertyPad.PropertyValueChanged -= PropertyValueChanged; propertyContainer.Clear(); IsFormsDesignerVisible = false; diff --git a/src/Main/Base/Project/Src/Gui/AbstractBaseViewContent.cs b/src/Main/Base/Project/Src/Gui/AbstractBaseViewContent.cs index de368d1cf5..45af29e452 100644 --- a/src/Main/Base/Project/Src/Gui/AbstractBaseViewContent.cs +++ b/src/Main/Base/Project/Src/Gui/AbstractBaseViewContent.cs @@ -55,6 +55,10 @@ namespace ICSharpCode.SharpDevelop.Gui public virtual void Deselected() { } + + public virtual void Deselecting() + { + } public virtual void RedrawContent() { diff --git a/src/Main/Base/Project/Src/Gui/IBaseViewContent.cs b/src/Main/Base/Project/Src/Gui/IBaseViewContent.cs index 5d471b5430..ae20de4306 100644 --- a/src/Main/Base/Project/Src/Gui/IBaseViewContent.cs +++ b/src/Main/Base/Project/Src/Gui/IBaseViewContent.cs @@ -50,6 +50,12 @@ namespace ICSharpCode.SharpDevelop.Gui /// tab. NOT when the windows is selected. /// void Selected(); + + /// + /// Is called just before the view content is deselected inside the window + /// tab before the other window is selected. NOT when the windows is deselected. + /// + void Deselecting(); /// /// Is called when the view content is deselected inside the window diff --git a/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs b/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs index 45bcf34bb0..0a508fbba3 100644 --- a/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs +++ b/src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs @@ -136,7 +136,9 @@ namespace ICSharpCode.SharpDevelop.Gui viewTabControl = new TabControl(); viewTabControl.Alignment = TabAlignment.Bottom; viewTabControl.Dock = DockStyle.Fill; - viewTabControl.SelectedIndexChanged += new EventHandler(viewTabControlIndexChanged); + viewTabControl.Selected += viewTabControlSelected; + viewTabControl.Deselecting += viewTabControlDeselecting; + viewTabControl.Deselected += viewTabControlDeselected; } internal void InitControls() @@ -200,11 +202,6 @@ namespace ICSharpCode.SharpDevelop.Gui WorkbenchSingleton.SafeThreadAsyncCall(new MethodInvoker(this.RefreshSecondaryViewContents)); } - void LeaveTabPage(object sender, EventArgs e) - { - OnWindowDeselected(EventArgs.Empty); - } - public IViewContent ViewContent { get { return content; @@ -260,6 +257,9 @@ namespace ICSharpCode.SharpDevelop.Gui if (viewTabControl != null) { foreach (TabPage page in viewTabControl.TabPages) { + if (viewTabControl.SelectedTab == page && page.Tag is IBaseViewContent) { + ((IBaseViewContent)page.Tag).Deselecting(); + } page.Controls.Clear(); if (viewTabControl.SelectedTab == page && page.Tag is IBaseViewContent) { ((IBaseViewContent)page.Tag).Deselected(); @@ -319,28 +319,40 @@ namespace ICSharpCode.SharpDevelop.Gui return content.SecondaryViewContents[index - 1]; } - int oldIndex = 0; - void viewTabControlIndexChanged(object sender, EventArgs e) + void viewTabControlSelected(object sender, TabControlEventArgs e) { - if (oldIndex >= 0) { - IBaseViewContent secondaryViewContent = GetSubViewContent(oldIndex); + if (e.Action == TabControlAction.Selected && e.TabPageIndex >= 0) { + IBaseViewContent secondaryViewContent = GetSubViewContent(e.TabPageIndex); if (secondaryViewContent != null) { secondaryViewContent.Deselected(); - } - } - - if (viewTabControl.SelectedIndex >= 0) { - IBaseViewContent secondaryViewContent = GetSubViewContent(viewTabControl.SelectedIndex); - if (secondaryViewContent != null) { secondaryViewContent.SwitchedTo(); secondaryViewContent.Selected(); } } - oldIndex = viewTabControl.SelectedIndex; WorkbenchSingleton.Workbench.WorkbenchLayout.OnActiveWorkbenchWindowChanged(EventArgs.Empty); ActiveViewContent.Control.Focus(); } + void viewTabControlDeselecting(object sender, TabControlCancelEventArgs e) + { + if (e.Action == TabControlAction.Deselecting && e.TabPageIndex >= 0) { + IBaseViewContent secondaryViewContent = GetSubViewContent(e.TabPageIndex); + if (secondaryViewContent != null) { + secondaryViewContent.Deselecting(); + } + } + } + + void viewTabControlDeselected(object sender, TabControlEventArgs e) + { + if (e.Action == TabControlAction.Deselected && e.TabPageIndex >= 0) { + IBaseViewContent secondaryViewContent = GetSubViewContent(e.TabPageIndex); + if (secondaryViewContent != null) { + secondaryViewContent.Deselected(); + } + } + } + public virtual void RedrawContent() { if (viewTabControl != null) { From d0ccf4ffd3e2804e03b4db8c911fd32c18d0f9e9 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 22 Feb 2006 17:39:02 +0000 Subject: [PATCH 03/10] Add generic overload of BuildItems. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1174 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../AddIn/DefaultDoozers/IncludeDoozer.cs | 6 ++-- .../AddInTree/AddIn/IBuildItemsModifier.cs | 2 +- .../Core/Project/Src/AddInTree/AddInTree.cs | 28 ++++++++++++++++ .../Project/Src/AddInTree/AddInTreeNode.cs | 33 +++++++++++++++++-- .../Core/Project/Src/AddInTree/CoreStartup.cs | 2 +- .../StartUp/Project/Dialogs/ExceptionBox.cs | 5 ++- .../SVNChangelogToXml.csproj | 14 ++++++-- .../SVNChangelogToXml.csproj.user | 5 +-- .../SVNChangeLogToXml/SVNChangelogToXml.sln | 16 +++++++++ .../UpdateAssemblyInfo.csproj | 13 ++++++++ .../UpdateAssemblyInfo/UpdateAssemblyInfo.sln | 14 ++++++-- 11 files changed, 123 insertions(+), 15 deletions(-) create mode 100644 src/Tools/SVNChangeLogToXml/SVNChangelogToXml.sln diff --git a/src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/IncludeDoozer.cs b/src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/IncludeDoozer.cs index 3ccddf72c8..9a1968dc93 100644 --- a/src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/IncludeDoozer.cs +++ b/src/Main/Core/Project/Src/AddInTree/AddIn/DefaultDoozers/IncludeDoozer.cs @@ -67,12 +67,14 @@ namespace ICSharpCode.Core this.path = path; } - public void Apply(ArrayList items) + public void Apply(IList items) { AddInTreeNode node; try { node = AddInTree.GetTreeNode(path); - items.AddRange(node.BuildChildItems(caller)); + foreach (object o in node.BuildChildItems(caller)) { + items.Add(o); + } } catch (TreePathNotFoundException) { MessageService.ShowError("IncludeDoozer: AddinTree-Path not found: " + path); } diff --git a/src/Main/Core/Project/Src/AddInTree/AddIn/IBuildItemsModifier.cs b/src/Main/Core/Project/Src/AddInTree/AddIn/IBuildItemsModifier.cs index 6f9c3d5cd3..919ea56317 100644 --- a/src/Main/Core/Project/Src/AddInTree/AddIn/IBuildItemsModifier.cs +++ b/src/Main/Core/Project/Src/AddInTree/AddIn/IBuildItemsModifier.cs @@ -21,6 +21,6 @@ namespace ICSharpCode.Core /// public interface IBuildItemsModifier { - void Apply(ArrayList items); + void Apply(IList items); } } diff --git a/src/Main/Core/Project/Src/AddInTree/AddInTree.cs b/src/Main/Core/Project/Src/AddInTree/AddInTree.cs index 72ef62a91f..d23677e39f 100644 --- a/src/Main/Core/Project/Src/AddInTree/AddInTree.cs +++ b/src/Main/Core/Project/Src/AddInTree/AddInTree.cs @@ -131,6 +131,34 @@ namespace ICSharpCode.Core return node.BuildChildItems(caller); } + /// + /// Builds the items in the path. Ensures that all items have the type T. + /// Throws an exception if the path is not found. + /// + /// A path in the addin tree. + /// The owner used to create the objects. + public static List BuildItems(string path, object caller) + { + return BuildItems(path, caller, true); + } + + /// + /// Builds the items in the path. Ensures that all items have the type T. + /// + /// A path in the addin tree. + /// The owner used to create the objects. + /// If true, throws an TreePathNotFoundException + /// if the path is not found. If false, an empty ArrayList is returned when the + /// path is not found. + public static List BuildItems(string path, object caller, bool throwOnNotFound) + { + AddInTreeNode node = GetTreeNode(path, throwOnNotFound); + if (node == null) + return new List(); + else + return node.BuildChildItems(caller); + } + static AddInTreeNode CreatePath(AddInTreeNode localRoot, string path) { if (path == null || path.Length == 0) { diff --git a/src/Main/Core/Project/Src/AddInTree/AddInTreeNode.cs b/src/Main/Core/Project/Src/AddInTree/AddInTreeNode.cs index ded429f05c..8ed54e62fc 100644 --- a/src/Main/Core/Project/Src/AddInTree/AddInTreeNode.cs +++ b/src/Main/Core/Project/Src/AddInTree/AddInTreeNode.cs @@ -36,7 +36,7 @@ namespace ICSharpCode.Core public AddInTreeNode() { } -// +// // public void BinarySerialize(BinaryWriter writer) // { // if (!isSorted) { @@ -47,7 +47,7 @@ namespace ICSharpCode.Core // foreach (Codon codon in codons) { // codon.BinarySerialize(writer); // } -// +// // writer.Write((ushort)childNodes.Count); // foreach (KeyValuePair child in childNodes) { // writer.Write(AddInTree.GetNameOffset(child.Key)); @@ -127,6 +127,35 @@ namespace ICSharpCode.Core } } + public List BuildChildItems(object caller) + { + List items = new List(codons.Count); + if (!isSorted) { + codons = (new TopologicalSort(codons)).Execute(); + isSorted = true; + } + foreach (Codon codon in codons) { + ArrayList subItems = null; + if (childNodes.ContainsKey(codon.Id)) { + subItems = childNodes[codon.Id].BuildChildItems(caller); + } + object result = codon.BuildItem(caller, subItems); + if (result == null) + continue; + IBuildItemsModifier mod = result as IBuildItemsModifier; + if (mod != null) { + mod.Apply(items); + } else if (result is T) { + items.Add((T)result); + } else { + throw new InvalidCastException("The AddInTreeNode <" + codon.Name + " id='" + codon.Id + + "' returned an instance of " + result.GetType().FullName + + " but the type " + typeof(T).FullName + " is expected."); + } + } + return items; + } + public ArrayList BuildChildItems(object caller) { ArrayList items = new ArrayList(codons.Count); diff --git a/src/Main/Core/Project/Src/AddInTree/CoreStartup.cs b/src/Main/Core/Project/Src/AddInTree/CoreStartup.cs index 4101816643..bcffbb0ee8 100644 --- a/src/Main/Core/Project/Src/AddInTree/CoreStartup.cs +++ b/src/Main/Core/Project/Src/AddInTree/CoreStartup.cs @@ -105,7 +105,7 @@ namespace ICSharpCode.Core // run workspace autostart commands LoggingService.Info("Running autostart commands..."); - foreach (ICommand command in AddInTree.BuildItems("/Workspace/Autostart", null, false)) { + foreach (ICommand command in AddInTree.BuildItems("/Workspace/Autostart", null, false)) { command.Run(); } } diff --git a/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs b/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs index 380fb60a8c..833335208a 100644 --- a/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs +++ b/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs @@ -54,7 +54,7 @@ namespace ICSharpCode.SharpDevelop string getClipboardString() { string str = ""; - str += ".NET Version : " + Environment.Version.ToString() + Environment.NewLine; + str += ".NET Version : " + Environment.Version.ToString() + Environment.NewLine; str += "OS Version : " + Environment.OSVersion.ToString() + Environment.NewLine; string cultureName = null; try { @@ -67,6 +67,9 @@ namespace ICSharpCode.SharpDevelop } } catch {} try { + if (IntPtr.Size != 4) { + str += "Running as " + (IntPtr.Size * 8) + " bit process" + Environment.NewLine; + } if (SystemInformation.TerminalServerSession) { str += "Terminal Server Session" + Environment.NewLine; } diff --git a/src/Tools/SVNChangeLogToXml/SVNChangelogToXml.csproj b/src/Tools/SVNChangeLogToXml/SVNChangelogToXml.csproj index 7179509b35..7d666987d7 100644 --- a/src/Tools/SVNChangeLogToXml/SVNChangelogToXml.csproj +++ b/src/Tools/SVNChangeLogToXml/SVNChangelogToXml.csproj @@ -11,11 +11,21 @@ False False OnSuccessfulBuild + False + Auto + 4194304 + x86 + 4096 + 4 + 1607 True True bin\Debug\ + False + False + false False @@ -23,7 +33,7 @@ False False bin\Release\ - True + true @@ -44,4 +54,4 @@ - \ No newline at end of file + diff --git a/src/Tools/SVNChangeLogToXml/SVNChangelogToXml.csproj.user b/src/Tools/SVNChangeLogToXml/SVNChangelogToXml.csproj.user index ef111b3b5e..7ff3943f7c 100644 --- a/src/Tools/SVNChangeLogToXml/SVNChangelogToXml.csproj.user +++ b/src/Tools/SVNChangeLogToXml/SVNChangelogToXml.csproj.user @@ -1,4 +1 @@ - - - - \ No newline at end of file + \ No newline at end of file diff --git a/src/Tools/SVNChangeLogToXml/SVNChangelogToXml.sln b/src/Tools/SVNChangeLogToXml/SVNChangelogToXml.sln new file mode 100644 index 0000000000..0f77f37a36 --- /dev/null +++ b/src/Tools/SVNChangeLogToXml/SVNChangelogToXml.sln @@ -0,0 +1,16 @@ +Microsoft Visual Studio Solution File, Format Version 9.00 +# SharpDevelop 2.0.0.1166 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SVNChangelogToXml", "SVNChangelogToXml.csproj", "{c6159c5e-f6ef-4a63-b152-0e49159b6059}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C6159C5E-F6EF-4A63-B152-0E49159B6059}.Debug|Any CPU.Build.0 = Debug|AnyCPU + {C6159C5E-F6EF-4A63-B152-0E49159B6059}.Debug|Any CPU.ActiveCfg = Debug|AnyCPU + {C6159C5E-F6EF-4A63-B152-0E49159B6059}.Release|Any CPU.Build.0 = Release|AnyCPU + {C6159C5E-F6EF-4A63-B152-0E49159B6059}.Release|Any CPU.ActiveCfg = Release|AnyCPU + EndGlobalSection +EndGlobal diff --git a/src/Tools/UpdateAssemblyInfo/UpdateAssemblyInfo.csproj b/src/Tools/UpdateAssemblyInfo/UpdateAssemblyInfo.csproj index c36719b437..33ed3132bd 100644 --- a/src/Tools/UpdateAssemblyInfo/UpdateAssemblyInfo.csproj +++ b/src/Tools/UpdateAssemblyInfo/UpdateAssemblyInfo.csproj @@ -6,6 +6,19 @@ Debug AnyCPU {605C8CDB-F0AD-4A21-9F4A-959B8DECB0F3} + False + False + False + None + False + Auto + 4194304 + x86 + 4096 + 4 + false + false + 1607 bin\Debug\ diff --git a/src/Tools/UpdateAssemblyInfo/UpdateAssemblyInfo.sln b/src/Tools/UpdateAssemblyInfo/UpdateAssemblyInfo.sln index 9714b77924..dd8aad1828 100644 --- a/src/Tools/UpdateAssemblyInfo/UpdateAssemblyInfo.sln +++ b/src/Tools/UpdateAssemblyInfo/UpdateAssemblyInfo.sln @@ -1,6 +1,16 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.0.0.232 +Microsoft Visual Studio Solution File, Format Version 9.00 +# SharpDevelop 2.0.0.1166 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpdateAssemblyInfo", "UpdateAssemblyInfo.csproj", "{605C8CDB-F0AD-4A21-9F4A-959B8DECB0F3}" EndProject Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {605C8CDB-F0AD-4A21-9F4A-959B8DECB0F3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {605C8CDB-F0AD-4A21-9F4A-959B8DECB0F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {605C8CDB-F0AD-4A21-9F4A-959B8DECB0F3}.Release|Any CPU.Build.0 = Release|Any CPU + {605C8CDB-F0AD-4A21-9F4A-959B8DECB0F3}.Release|Any CPU.ActiveCfg = Release|Any CPU + EndGlobalSection EndGlobal From 493e79270902eb07e5a20c00e0bad6f3e2a888b8 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Wed, 22 Feb 2006 17:58:37 +0000 Subject: [PATCH 04/10] Fixed SD2-700: Exception when selecting AddIn Manager About option Fixed SD2-687: Cannot build entire solution after importing SharpDevelop 1.1 project git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1175 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- src/AddIns/Misc/AddInManager/Project/Src/AboutForm.cs | 2 ++ src/Main/Base/Project/Src/Project/Solution/Solution.cs | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/AddIns/Misc/AddInManager/Project/Src/AboutForm.cs b/src/AddIns/Misc/AddInManager/Project/Src/AboutForm.cs index c9ff7d56f5..d6f7306341 100644 --- a/src/AddIns/Misc/AddInManager/Project/Src/AboutForm.cs +++ b/src/AddIns/Misc/AddInManager/Project/Src/AboutForm.cs @@ -121,6 +121,8 @@ namespace ICSharpCode.AddInManager string GetLink(string text) { + if (text == null) + return null; switch (text) { case "GNU General Public License": case "GPL": diff --git a/src/Main/Base/Project/Src/Project/Solution/Solution.cs b/src/Main/Base/Project/Src/Project/Solution/Solution.cs index a0f795a36d..48058dc6de 100644 --- a/src/Main/Base/Project/Src/Project/Solution/Solution.cs +++ b/src/Main/Base/Project/Src/Project/Solution/Solution.cs @@ -593,12 +593,18 @@ namespace ICSharpCode.SharpDevelop.Project } newSolution.fileName = Path.ChangeExtension(fileName, ".sln"); ICSharpCode.SharpDevelop.Project.Converter.CombineToSolution.ConvertSolution(newSolution, fileName); + if (newSolution.FixSolutionConfiguration(newSolution.Projects)) { + newSolution.Save(); + } } else if (extension == ".PRJX") { if (!MessageService.AskQuestion("${res:SharpDevelop.Solution.ImportPrjx}")) { return null; } newSolution.fileName = Path.ChangeExtension(fileName, ".sln"); ICSharpCode.SharpDevelop.Project.Converter.CombineToSolution.ConvertProject(newSolution, fileName); + if (newSolution.FixSolutionConfiguration(newSolution.Projects)) { + newSolution.Save(); + } } else { newSolution.fileName = fileName; if (!SetupSolution(newSolution, fileName)) { From 05aa4c4885b43d14c0bfc3c52b4fe9d28a489d78 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Thu, 23 Feb 2006 17:35:28 +0000 Subject: [PATCH 05/10] Fixed exception when loading a project when a referenced library was missing dependencies. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1176 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Src/Dom/ReflectionLayer/ReflectionLoader.cs | 12 ++++++++---- .../ParserService/ProjectContentRegistry.cs | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionLoader.cs b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionLoader.cs index 2d1af33506..09896f72df 100644 --- a/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionLoader.cs +++ b/src/Main/Base/Project/Src/Dom/ReflectionLayer/ReflectionLoader.cs @@ -27,7 +27,11 @@ namespace ICSharpCode.SharpDevelop.Dom return null; return DomPersistence.SaveProjectContent(content); } catch (Exception ex) { - LoggingService.Error(ex); + if (ex is FileLoadException) { + LoggingService.Info(ex); + } else { + LoggingService.Error(ex); + } throw; } } @@ -48,10 +52,10 @@ namespace ICSharpCode.SharpDevelop.Dom if (assembly != null) return new ReflectionProjectContent(assembly); else - return null; - } catch (BadImageFormatException) { + throw new FileLoadException("Assembly not found."); + } catch (BadImageFormatException ex) { LoggingService.Warn("BadImageFormat: " + include); - return null; + throw new FileLoadException(ex.Message, ex); } finally { AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve -= AssemblyResolve; lookupDirectory = null; diff --git a/src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs b/src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs index 94587d508b..11dc3fa775 100644 --- a/src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs +++ b/src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs @@ -172,9 +172,13 @@ namespace ICSharpCode.Core object o = domain.CreateInstanceAndUnwrap(typeof(ReflectionLoader).Assembly.FullName, typeof(ReflectionLoader).FullName); ReflectionLoader loader = (ReflectionLoader)o; database = loader.LoadAndCreateDatabase(filename, include); + } catch (FileLoadException e) { + database = null; + WorkbenchSingleton.SafeThreadAsyncCall((Action3)ShowErrorMessage, + new object[] { filename, include, e.Message }); } catch (Exception e) { database = null; - MessageService.ShowError(e, "Error loading " + include + " from " + filename); + MessageService.ShowError(e, "Error loading code-completion information for " + include + " from " + filename); } finally { AppDomain.Unload(domain); } @@ -187,6 +191,16 @@ namespace ICSharpCode.Core } } + delegate void Action3(A a, B b, C c); + + static void ShowErrorMessage(string filename, string include, string message) + { + WorkbenchSingleton.Workbench.GetPad(typeof(CompilerMessageView)).BringPadToFront(); + TaskService.BuildMessageViewCategory.AppendText("Error loading code-completion information for " + + include + " from " + filename + + ":\r\n" + message + "\r\n"); + } + public static Assembly MscorlibAssembly { get { return typeof(object).Assembly; From 23d5b75f682441676b4caa0cb5046bd5f30a8a2d Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Fri, 24 Feb 2006 20:03:25 +0000 Subject: [PATCH 06/10] Fixed crash when trying to view components in assembly Microsoft.VisualStudio.CommonIDE. (forum-5369) git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1178 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Resources/AddSidebarComponentsDialog.xfrm | 99 +++++++++---------- .../Project/Src/Gui/AddComponentsDialog.cs | 76 +++++++------- .../Src/Services/Debugger/DebuggerService.cs | 2 +- 3 files changed, 82 insertions(+), 95 deletions(-) diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Resources/AddSidebarComponentsDialog.xfrm b/src/AddIns/DisplayBindings/FormsDesigner/Project/Resources/AddSidebarComponentsDialog.xfrm index 4e0b8481eb..a39876b7a4 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Resources/AddSidebarComponentsDialog.xfrm +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Resources/AddSidebarComponentsDialog.xfrm @@ -1,64 +1,61 @@ - - - - - + + + - - + + + - - - + + + - - - - + + - - + + - - - - + + + + - - + + - + @@ -72,53 +69,50 @@ + - - - + + + - - + - - + - - - + + + - - - + - - + - - - + + + + - + @@ -133,41 +127,38 @@ - - - + - - + + - + - - + + - + + - - - + diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/AddComponentsDialog.cs b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/AddComponentsDialog.cs index 8b02cc7ba5..058ae573f5 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/AddComponentsDialog.cs +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/AddComponentsDialog.cs @@ -92,52 +92,48 @@ namespace ICSharpCode.FormsDesigner.Gui } catch {} } try { - Module[] ms = assembly.GetModules(false); ((ListView)ControlDictionary["componentListView"]).SmallImageList = il; - foreach (Module m in ms) { - Type[] ts = m.GetTypes(); - foreach (Type t in ts) { - if (t.IsPublic && !t.IsAbstract) { - if (t.IsDefined(typeof(ToolboxItemFilterAttribute), true) || t.IsDefined(typeof(ToolboxItemAttribute), true) || typeof(System.ComponentModel.IComponent).IsAssignableFrom(t)) { - object[] attributes = t.GetCustomAttributes(false); - object[] filterAttrs = t.GetCustomAttributes(typeof(DesignTimeVisibleAttribute), true); - foreach (DesignTimeVisibleAttribute visibleAttr in filterAttrs) { - if (!visibleAttr.Visible) { - goto skip; - } + foreach (Type t in assembly.GetExportedTypes()) { + if (!t.IsAbstract) { + if (t.IsDefined(typeof(ToolboxItemFilterAttribute), true) || t.IsDefined(typeof(ToolboxItemAttribute), true) || typeof(System.ComponentModel.IComponent).IsAssignableFrom(t)) { + object[] attributes = t.GetCustomAttributes(false); + object[] filterAttrs = t.GetCustomAttributes(typeof(DesignTimeVisibleAttribute), true); + foreach (DesignTimeVisibleAttribute visibleAttr in filterAttrs) { + if (!visibleAttr.Visible) { + goto skip; } - - if (images[t.FullName + ".bmp"] == null) { - if (t.IsDefined(typeof(ToolboxBitmapAttribute), false)) { - foreach (object attr in attributes) { - if (attr is ToolboxBitmapAttribute) { - ToolboxBitmapAttribute toolboxBitmapAttribute = (ToolboxBitmapAttribute)attr; - images[t.FullName + ".bmp"] = il.Images.Count; - Bitmap b = new Bitmap(toolboxBitmapAttribute.GetImage(t)); - b.MakeTransparent(); - il.Images.Add(b); - break; - } + } + + if (images[t.FullName + ".bmp"] == null) { + if (t.IsDefined(typeof(ToolboxBitmapAttribute), false)) { + foreach (object attr in attributes) { + if (attr is ToolboxBitmapAttribute) { + ToolboxBitmapAttribute toolboxBitmapAttribute = (ToolboxBitmapAttribute)attr; + images[t.FullName + ".bmp"] = il.Images.Count; + Bitmap b = new Bitmap(toolboxBitmapAttribute.GetImage(t)); + b.MakeTransparent(); + il.Images.Add(b); + break; } } } - - ListViewItem newItem = new ListViewItem(t.Name); - newItem.SubItems.Add(t.Namespace); - newItem.SubItems.Add(assembly.ToString()); - newItem.SubItems.Add(assembly.Location); - newItem.SubItems.Add(t.Namespace); - if (images[t.FullName + ".bmp"] != null) { - newItem.ImageIndex = (int)images[t.FullName + ".bmp"]; - } - newItem.Checked = true; - ToolComponent toolComponent = new ToolComponent(t.FullName, new ComponentAssembly(assembly.FullName, loadPath)); - toolComponent.IsEnabled = true; - newItem.Tag = toolComponent; - ((ListView)ControlDictionary["componentListView"]).Items.Add(newItem); - ToolboxItem item = new ToolboxItem(t); - skip:; } + + ListViewItem newItem = new ListViewItem(t.Name); + newItem.SubItems.Add(t.Namespace); + newItem.SubItems.Add(assembly.ToString()); + newItem.SubItems.Add(assembly.Location); + newItem.SubItems.Add(t.Namespace); + if (images[t.FullName + ".bmp"] != null) { + newItem.ImageIndex = (int)images[t.FullName + ".bmp"]; + } + newItem.Checked = true; + ToolComponent toolComponent = new ToolComponent(t.FullName, new ComponentAssembly(assembly.FullName, loadPath)); + toolComponent.IsEnabled = true; + newItem.Tag = toolComponent; + ((ListView)ControlDictionary["componentListView"]).Items.Add(newItem); + ToolboxItem item = new ToolboxItem(t); + skip:; } } } diff --git a/src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs b/src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs index a412babd6a..00bd216562 100644 --- a/src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs +++ b/src/Main/Base/Project/Src/Services/Debugger/DebuggerService.cs @@ -55,7 +55,7 @@ namespace ICSharpCode.Core project = ProjectService.OpenSolution.StartupProject; } foreach (DebuggerDescriptor d in debuggers) { - if (d.Debugger.CanDebug(project)) { + if (d.Debugger != null && d.Debugger.CanDebug(project)) { return d.Debugger; } } From 7d9df5908588e5a9ddd71cb999c4ab49324da8b5 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Fri, 24 Feb 2006 20:30:22 +0000 Subject: [PATCH 07/10] Fixed forum-5455: Importing old Visual Studio projects with non-ASCII characters in system encoding fails. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1179 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Converter/PrjxToSolutionProject.cs | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/Main/Base/Project/Src/Project/Converter/PrjxToSolutionProject.cs b/src/Main/Base/Project/Src/Project/Converter/PrjxToSolutionProject.cs index 7591d017b1..d4183be344 100644 --- a/src/Main/Base/Project/Src/Project/Converter/PrjxToSolutionProject.cs +++ b/src/Main/Base/Project/Src/Project/Converter/PrjxToSolutionProject.cs @@ -209,10 +209,8 @@ namespace ICSharpCode.SharpDevelop.Project.Converter static Dictionary xsltDict = new Dictionary(); - public static void RunConverter(string inFile, string outFile, string script, Conversion conversion) + public static void RunConverter(TextReader inFile, string outFile, string script, Conversion conversion) { - conversion.basePath = Path.GetDirectoryName(inFile); - XslCompiledTransform xslt; if (xsltDict.ContainsKey(script)) { xslt = xsltDict[script]; @@ -255,9 +253,13 @@ namespace ICSharpCode.SharpDevelop.Project.Converter else convertedFileName = Path.ChangeExtension(fileName, ".csproj"); - RunConverter(fileName, convertedFileName, "CSharp_prjx2csproj.xsl", conversion); - - RunConverter(fileName, convertedFileName + ".user", "CSharp_prjx2csproj_user.xsl", conversion); + conversion.basePath = Path.GetDirectoryName(fileName); + using (StreamReader fileReader = new StreamReader(fileName)) { + RunConverter(fileReader, convertedFileName, "CSharp_prjx2csproj.xsl", conversion); + } + using (StreamReader fileReader = new StreamReader(fileName)) { + RunConverter(fileReader, convertedFileName + ".user", "CSharp_prjx2csproj_user.xsl", conversion); + } return LanguageBindingService.LoadProject(convertedFileName, Conversion.GetProjectName(fileName)); } @@ -279,9 +281,15 @@ namespace ICSharpCode.SharpDevelop.Project.Converter if (Solution.SolutionBeingLoaded != null) { Solution.ReadSolutionInformation(Solution.SolutionBeingLoaded.FileName, conversion); } - RunConverter(old, fileName, "vsnet2msbuild.xsl", conversion); + + conversion.basePath = Path.GetDirectoryName(fileName); + + Encoding tmp = Encoding.Default; + string content = ICSharpCode.TextEditor.Util.FileReader.ReadFileContent(old, ref tmp, tmp); + RunConverter(new StringReader(content), fileName, "vsnet2msbuild.xsl", conversion); if (File.Exists(oldUserFile)) { - RunConverter(oldUserFile, userFile, "vsnet2msbuild_user.xsl", conversion); + content = ICSharpCode.TextEditor.Util.FileReader.ReadFileContent(oldUserFile, ref tmp, tmp); + RunConverter(new StringReader(content), userFile, "vsnet2msbuild_user.xsl", conversion); } } } From 0dac40f144bd884fdb6de72304a8a2f413ec58ff Mon Sep 17 00:00:00 2001 From: Matt Ward Date: Sat, 25 Feb 2006 12:12:25 +0000 Subject: [PATCH 08/10] Fixed SD2-662, SD2-664 - Replace all inserting incorrect text or getting stuck in an infinite loop. The search and replace manager was replacing the text twice if the document was open in SharpDevelop. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1180 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../SearchAndReplace/Engine/SearchReplaceManager.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/SearchReplaceManager.cs b/src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/SearchReplaceManager.cs index 377fb0f3c4..287f6ba658 100644 --- a/src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/SearchReplaceManager.cs +++ b/src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Engine/SearchReplaceManager.cs @@ -138,7 +138,9 @@ namespace SearchAndReplace string transformedPattern = result.TransformReplacePattern(SearchOptions.ReplacePattern); find.Replace(result.Offset, result.Length, transformedPattern); - textArea.Document.Replace(result.Offset, result.Length, transformedPattern); + if (find.CurrentDocumentInformation.Document == null) { + textArea.Document.Replace(result.Offset, result.Length, transformedPattern); + } } } } From 579134aeecc315633c15d668a7c9427b5b35f2a3 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 25 Feb 2006 16:24:07 +0000 Subject: [PATCH 09/10] Fixed SD2-676: Code completion for a class with many methods can be slow Overrides are now only searched for overridable methods - this speeds up code-completion on classes with many non-virtual (or static) methods. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1182 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- src/Main/Base/Project/Src/Dom/IDecoration.cs | 10 +++++++ .../Dom/Implementations/AbstractDecoration.cs | 5 ++++ .../Dom/Implementations/DefaultReturnType.cs | 30 +++++++++++-------- .../StartUp/Project/Dialogs/ExceptionBox.cs | 11 ++++++- 4 files changed, 43 insertions(+), 13 deletions(-) diff --git a/src/Main/Base/Project/Src/Dom/IDecoration.cs b/src/Main/Base/Project/Src/Dom/IDecoration.cs index 6b2a0cfccd..e23da782d5 100644 --- a/src/Main/Base/Project/Src/Dom/IDecoration.cs +++ b/src/Main/Base/Project/Src/Dom/IDecoration.cs @@ -46,6 +46,10 @@ namespace ICSharpCode.SharpDevelop.Dom get; } + /// + /// Gets if the member is virtual. Is true only if the "virtual" modifier was used, but non-virtual + /// members can be overridden, too; if they are already overriding a method. + /// bool IsVirtual { get; } @@ -86,6 +90,12 @@ namespace ICSharpCode.SharpDevelop.Dom bool IsOverride { get; } + /// + /// Gets if the member can be overridden. Returns true when the member is "virtual" or "override" but not "sealed". + /// + bool IsOverridable { + get; + } bool IsNew { get; diff --git a/src/Main/Base/Project/Src/Dom/Implementations/AbstractDecoration.cs b/src/Main/Base/Project/Src/Dom/Implementations/AbstractDecoration.cs index ff0dbc7b37..12afb67c04 100644 --- a/src/Main/Base/Project/Src/Dom/Implementations/AbstractDecoration.cs +++ b/src/Main/Base/Project/Src/Dom/Implementations/AbstractDecoration.cs @@ -164,6 +164,11 @@ namespace ICSharpCode.SharpDevelop.Dom return (modifiers & ModifierEnum.Override) == ModifierEnum.Override; } } + public bool IsOverridable { + get { + return (IsOverride || IsVirtual) && !IsSealed; + } + } public bool IsNew { get { return (modifiers & ModifierEnum.New) == ModifierEnum.New; diff --git a/src/Main/Base/Project/Src/Dom/Implementations/DefaultReturnType.cs b/src/Main/Base/Project/Src/Dom/Implementations/DefaultReturnType.cs index 606d0aff53..f78dfd5fd9 100644 --- a/src/Main/Base/Project/Src/Dom/Implementations/DefaultReturnType.cs +++ b/src/Main/Base/Project/Src/Dom/Implementations/DefaultReturnType.cs @@ -57,12 +57,15 @@ namespace ICSharpCode.SharpDevelop.Dom // do not add methods that were overridden bool ok = true; - foreach (IMethod oldMethod in l) { - if (string.Equals(oldMethod.Name, m.Name, StringComparison.InvariantCultureIgnoreCase)) { - if (m.IsStatic == oldMethod.IsStatic) { - if (DiffUtility.Compare(oldMethod.Parameters, m.Parameters) == 0) { - ok = false; - break; + if (m.IsOverridable) { + StringComparer comparer = m.DeclaringType.ProjectContent.Language.NameComparer; + foreach (IMethod oldMethod in l) { + if (comparer.Equals(oldMethod.Name, m.Name)) { + if (m.IsStatic == oldMethod.IsStatic) { + if (DiffUtility.Compare(oldMethod.Parameters, m.Parameters) == 0) { + ok = false; + break; + } } } } @@ -84,12 +87,15 @@ namespace ICSharpCode.SharpDevelop.Dom foreach (IProperty p in bc.Properties) { // do not add methods that were overridden bool ok = true; - foreach (IProperty oldProperty in l) { - if (string.Equals(oldProperty.Name, p.Name, StringComparison.InvariantCultureIgnoreCase)) { - if (p.IsStatic == oldProperty.IsStatic) { - if (DiffUtility.Compare(oldProperty.Parameters, p.Parameters) == 0) { - ok = false; - break; + if (p.IsOverridable) { + StringComparer comparer = p.DeclaringType.ProjectContent.Language.NameComparer; + foreach (IProperty oldProperty in l) { + if (comparer.Equals(oldProperty.Name, p.Name)) { + if (p.IsStatic == oldProperty.IsStatic) { + if (DiffUtility.Compare(oldProperty.Parameters, p.Parameters) == 0) { + ok = false; + break; + } } } } diff --git a/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs b/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs index 833335208a..3a6afe41db 100644 --- a/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs +++ b/src/Main/StartUp/Project/Dialogs/ExceptionBox.cs @@ -12,6 +12,7 @@ using System.Diagnostics; using System.Resources; using System.Reflection; using System.Drawing; +using System.Threading; using System.Globalization; using ICSharpCode.Core; @@ -93,7 +94,15 @@ namespace ICSharpCode.SharpDevelop void CopyInfoToClipboard() { if (copyErrorCheckBox.Checked) { - ClipboardWrapper.SetText(getClipboardString()); + if (Application.OleRequired() == ApartmentState.STA) { + ClipboardWrapper.SetText(getClipboardString()); + } else { + Thread th = new Thread((ThreadStart)delegate { + ClipboardWrapper.SetText(getClipboardString()); + }); + th.SetApartmentState(ApartmentState.STA); + th.Start(); + } } } From 4dbfac0f4e6467b4b7e7617fd9858f240ad64eec Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Sat, 25 Feb 2006 16:52:35 +0000 Subject: [PATCH 10/10] Fixed SD2-688: Selecting GAC list items in the Add Components dialog git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/2.0@1183 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../Project/Src/Gui/AddComponentsDialog.cs | 58 +++++++++++-------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/AddComponentsDialog.cs b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/AddComponentsDialog.cs index 058ae573f5..2e38dc888a 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/AddComponentsDialog.cs +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/AddComponentsDialog.cs @@ -25,6 +25,7 @@ namespace ICSharpCode.FormsDesigner.Gui public class AddComponentsDialog : BaseSharpDevelopForm { ArrayList selectedComponents; + ListView componentListView; public ArrayList SelectedComponents { get { @@ -36,6 +37,8 @@ namespace ICSharpCode.FormsDesigner.Gui { SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.FormsDesigner.Resources.AddSidebarComponentsDialog.xfrm")); + componentListView = (ListView)ControlDictionary["componentListView"]; + Icon = null; PrintGACCache(); @@ -53,11 +56,11 @@ namespace ICSharpCode.FormsDesigner.Gui IAssemblyName assemblyName = null; Fusion.CreateAssemblyEnum(out assemblyEnum, null, null, 2, 0); - + while (assemblyEnum.GetNextAssembly(out applicationContext, out assemblyName, 0) == 0) { uint nChars = 0; assemblyName.GetDisplayName(null, ref nChars, 0); - + StringBuilder sb = new StringBuilder((int)nChars); assemblyName.GetDisplayName(sb, ref nChars, 0); @@ -74,8 +77,9 @@ namespace ICSharpCode.FormsDesigner.Gui void FillComponents(Assembly assembly, string loadPath) { - ((ListView)ControlDictionary["componentListView"]).BeginUpdate(); - ((ListView)ControlDictionary["componentListView"]).Items.Clear(); + componentListView.BeginUpdate(); + componentListView.Items.Clear(); + componentListView.Controls.Clear(); if (assembly != null) { Hashtable images = new Hashtable(); @@ -92,7 +96,7 @@ namespace ICSharpCode.FormsDesigner.Gui } catch {} } try { - ((ListView)ControlDictionary["componentListView"]).SmallImageList = il; + componentListView.SmallImageList = il; foreach (Type t in assembly.GetExportedTypes()) { if (!t.IsAbstract) { if (t.IsDefined(typeof(ToolboxItemFilterAttribute), true) || t.IsDefined(typeof(ToolboxItemAttribute), true) || typeof(System.ComponentModel.IComponent).IsAssignableFrom(t)) { @@ -131,41 +135,49 @@ namespace ICSharpCode.FormsDesigner.Gui ToolComponent toolComponent = new ToolComponent(t.FullName, new ComponentAssembly(assembly.FullName, loadPath)); toolComponent.IsEnabled = true; newItem.Tag = toolComponent; - ((ListView)ControlDictionary["componentListView"]).Items.Add(newItem); + componentListView.Items.Add(newItem); ToolboxItem item = new ToolboxItem(t); skip:; } } } } catch (Exception e) { - MessageService.ShowError(e); + ClearComponentsList(e.Message); + } + if (componentListView.Items.Count == 0) { + if (componentListView.Controls.Count == 0) { + ClearComponentsList(StringParser.Parse("${res:ICSharpCode.SharpDevelop.FormDesigner.Gui.AddSidebarComponents.NoComponentsFound}", new string[,] {{"Name", assembly.FullName}})); + } } } - ((ListView)ControlDictionary["componentListView"]).EndUpdate(); + componentListView.EndUpdate(); } - /* changed this unexpected behaviour -- added a load button, G.B. - void fileNameTextBoxTextChanged(object sender, System.EventArgs e) + void gacListViewSelectedIndexChanged(object sender, System.EventArgs e) { - if (File.Exists(this.fileNameTextBox.Text)) { + if (((ListView)ControlDictionary["gacListView"]).SelectedItems != null && ((ListView)ControlDictionary["gacListView"]).SelectedItems.Count == 1) { + string assemblyName = ((ListView)ControlDictionary["gacListView"]).SelectedItems[0].Tag.ToString(); try { - FillComponents(Assembly.LoadFrom(this.fileNameTextBox.Text)); + Assembly asm = Assembly.Load(assemblyName); + FillComponents(asm, null); } catch (Exception ex) { - - MessageService.ShowError(ex); + ClearComponentsList(ex.Message); } + } else { + ClearComponentsList(null); } } - */ - void gacListViewSelectedIndexChanged(object sender, System.EventArgs e) + void ClearComponentsList(string message) { - if (((ListView)ControlDictionary["gacListView"]).SelectedItems != null && ((ListView)ControlDictionary["gacListView"]).SelectedItems.Count == 1) { - string assemblyName = ((ListView)ControlDictionary["gacListView"]).SelectedItems[0].Tag.ToString(); - Assembly asm = Assembly.Load(assemblyName); - FillComponents(asm, null); - } else { - FillComponents(null, null); + componentListView.Items.Clear(); + componentListView.Controls.Clear(); + if (message != null) { + Label lbl = new Label(); + lbl.BackColor = SystemColors.Window; + lbl.Text = StringParser.Parse(message); + lbl.Dock = DockStyle.Fill; + componentListView.Controls.Add(lbl); } } @@ -189,7 +201,7 @@ namespace ICSharpCode.FormsDesigner.Gui void buttonClick(object sender, System.EventArgs e) { selectedComponents = new ArrayList(); - foreach (ListViewItem item in ((ListView)ControlDictionary["componentListView"]).Items) { + foreach (ListViewItem item in componentListView.Items) { if (item.Checked) { selectedComponents.Add((ToolComponent)item.Tag); }