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/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/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/AddComponentsDialog.cs b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/AddComponentsDialog.cs index 8b02cc7ba5..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,84 +96,88 @@ 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; - } + 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)) { + 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; + 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); } } @@ -193,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); } 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); + } + } } } 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/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/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/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 970520f53f..827a700687 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) { 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); } } } 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)) { 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; } } 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; 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); + } } } } 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 c7f5bf4bfa..0b30e3cf7c 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..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; @@ -54,7 +55,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 +68,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; } @@ -90,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(); + } } } 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/StringResourceToolAddIn/StringResourceToolAddIn.sln b/src/Tools/StringResourceToolAddIn/StringResourceToolAddIn.sln new file mode 100644 index 0000000000..ecf2c11a13 --- /dev/null +++ b/src/Tools/StringResourceToolAddIn/StringResourceToolAddIn.sln @@ -0,0 +1,16 @@ +Microsoft Visual Studio Solution File, Format Version 9.00 +# SharpDevelop 2.1.0.9999 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StringResourceToolAddIn", "StringResourceToolAddIn.csproj", "{3648E209-B853-4168-BFB5-7A60EAF316F8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|AnyCPU = Debug|AnyCPU + Release|AnyCPU = Release|AnyCPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3648E209-B853-4168-BFB5-7A60EAF316F8}.Debug|AnyCPU.Build.0 = Debug|Any CPU + {3648E209-B853-4168-BFB5-7A60EAF316F8}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU + {3648E209-B853-4168-BFB5-7A60EAF316F8}.Release|AnyCPU.Build.0 = Release|Any CPU + {3648E209-B853-4168-BFB5-7A60EAF316F8}.Release|AnyCPU.ActiveCfg = Release|Any CPU + 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\