From 9736ca6d4f9da2a025a84fb57b7f23497e139433 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Tue, 8 Jan 2008 18:43:56 +0000 Subject: [PATCH] Fixed forum-7126: Template RunCommand's only work on new solutions Forum-7191: When NSvn.Client initialization fails, disable project browser overlays. Exception handler in ParserService.ParserFile: show the name of the file that caused the exception. AsynchronousAdvancedHighlighter: do not try to highlight deleted lines. This should fix the bug reported in forum-7175. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2793 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../HistoryViewDisplayBinding.cs | 6 +++++- .../OverlayIconManager.cs | 18 ++++++++++++++++-- .../Src/Gui/Dialogs/NewProjectDialog.cs | 2 +- .../Services/ParserService/ParserService.cs | 2 +- .../Gui/Editor/AdvancedHighlighter.cs | 2 ++ 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/HistoryViewDisplayBinding.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/HistoryViewDisplayBinding.cs index beb099f2d8..d7436fd56b 100644 --- a/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/HistoryViewDisplayBinding.cs +++ b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/HistoryViewDisplayBinding.cs @@ -43,7 +43,11 @@ namespace ICSharpCode.Svn { if (client == null) { LoggingService.Info("SVN: HistoryViewDisplayBinding initializes client"); - client = new Client(); + try { + client = new Client(); + } catch (Exception ex) { + LoggingService.Warn(ex); + } } try { Status status = client.SingleStatus(Path.GetFullPath(fileName)); diff --git a/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/ProjectBrowserVisitor/OverlayIconManager.cs b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/ProjectBrowserVisitor/OverlayIconManager.cs index 55b3fcb221..c3fcd44516 100644 --- a/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/ProjectBrowserVisitor/OverlayIconManager.cs +++ b/src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/ProjectBrowserVisitor/OverlayIconManager.cs @@ -88,6 +88,8 @@ namespace ICSharpCode.Svn public static void Enqueue(AbstractProjectBrowserTreeNode node) { + if (subversionDisabled) + return; lock (queue) { queue.Enqueue(node); if (queue.Count == 1) { @@ -98,6 +100,8 @@ namespace ICSharpCode.Svn public static void EnqueueRecursive(AbstractProjectBrowserTreeNode node) { + if (subversionDisabled) + return; lock (queue) { bool wasEmpty = queue.Count == 0; @@ -123,6 +127,7 @@ namespace ICSharpCode.Svn } static Client client; + static bool subversionDisabled; static void Run(object state) { @@ -153,9 +158,18 @@ namespace ICSharpCode.Svn static void RunStep(AbstractProjectBrowserTreeNode node) { - if (node.IsDisposed) return; + if (subversionDisabled || node.IsDisposed) return; if (client == null) { - client = new Client(); + try { + client = new Client(); + } catch (Exception ex) { + SharpDevelop.Gui.WorkbenchSingleton.SafeThreadAsyncCall( + MessageService.ShowWarning, + "Error initializing Subversion library:\n" + ex.ToString() + ); + subversionDisabled = true; + return; + } } FileNode fileNode = node as FileNode; Status status; diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/NewProjectDialog.cs b/src/Main/Base/Project/Src/Gui/Dialogs/NewProjectDialog.cs index 376998d0b3..7fc6d5a92f 100644 --- a/src/Main/Base/Project/Src/Gui/Dialogs/NewProjectDialog.cs +++ b/src/Main/Base/Project/Src/Gui/Dialogs/NewProjectDialog.cs @@ -337,8 +337,8 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs } if (createNewSolution) { ProjectService.LoadSolution(NewSolutionLocation); - item.Template.RunOpenActions(cinfo); } + item.Template.RunOpenActions(cinfo); NewProjectLocation = cinfo.createdProjects.Count > 0 ? cinfo.createdProjects[0].FileName : ""; DialogResult = DialogResult.OK; diff --git a/src/Main/Base/Project/Src/Services/ParserService/ParserService.cs b/src/Main/Base/Project/Src/Services/ParserService/ParserService.cs index ec9c511476..bbba142ad0 100644 --- a/src/Main/Base/Project/Src/Services/ParserService/ParserService.cs +++ b/src/Main/Base/Project/Src/Services/ParserService/ParserService.cs @@ -588,7 +588,7 @@ namespace ICSharpCode.SharpDevelop } return UpdateParseInformation(parserOutput, fileName, updateCommentTags); } catch (Exception e) { - MessageService.ShowError(e); + MessageService.ShowError(e, "Error parsing " + fileName); } return null; } diff --git a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/AdvancedHighlighter.cs b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/AdvancedHighlighter.cs index 0f52516cc9..1c5960e51a 100644 --- a/src/Main/Base/Project/Src/TextEditor/Gui/Editor/AdvancedHighlighter.cs +++ b/src/Main/Base/Project/Src/TextEditor/Gui/Editor/AdvancedHighlighter.cs @@ -169,6 +169,8 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor // We cannot call MarkLine inside lock(lockObject) because then the main // thread could deadlock with the highlighter thread. foreach (KeyValuePair> pair in oldOutstanding) { + if (pair.Key.IsDeleted) + continue; int offset = pair.Key.Offset; if (offset < 0 || offset >= document.TextLength) continue;