Browse Source

Fixed SD2-1335. Xml editor now catches any WebExceptions which can occur for any externally referenced DTDs when the user is offline.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3521 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 17 years ago
parent
commit
e857b636d9
  1. 5
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/IXmlTreeView.cs
  2. 5
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlTreeEditor.cs
  3. 7
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlTreeViewContainerControl.cs
  4. 3
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlView.cs
  5. 4
      src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockXmlTreeView.cs

5
src/AddIns/DisplayBindings/XmlEditor/Project/Src/IXmlTreeView.cs

@ -19,6 +19,11 @@ namespace ICSharpCode.XmlEditor @@ -19,6 +19,11 @@ namespace ICSharpCode.XmlEditor
/// <param name="ex">The exception that occurred when the xml
/// was loaded.</param>
void ShowXmlIsNotWellFormedMessage(XmlException ex);
/// <summary>
/// Displays an error message.
/// </summary>
void ShowErrorMessage(string message);
/// <summary>
/// Gets or sets whether this view needs saving.

5
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlTreeEditor.cs

@ -7,8 +7,10 @@ @@ -7,8 +7,10 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Xml;
using ICSharpCode.Core;
using ICSharpCode.TextEditor.Gui.CompletionWindow;
namespace ICSharpCode.XmlEditor
@ -42,6 +44,9 @@ namespace ICSharpCode.XmlEditor @@ -42,6 +44,9 @@ namespace ICSharpCode.XmlEditor
view.Document = document;
} catch (XmlException ex) {
view.ShowXmlIsNotWellFormedMessage(ex);
} catch (WebException ex) {
LoggingService.Debug(ex.ToString());
view.ShowErrorMessage(ex.Message);
}
}

7
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlTreeViewContainerControl.cs

@ -141,9 +141,14 @@ namespace ICSharpCode.XmlEditor @@ -141,9 +141,14 @@ namespace ICSharpCode.XmlEditor
}
public void ShowXmlIsNotWellFormedMessage(XmlException ex)
{
ShowErrorMessage(ex.Message);
}
public void ShowErrorMessage(string message)
{
xmlElementTreeView.Clear();
ErrorMessage = ex.Message;
ErrorMessage = message;
IsErrorMessageTextBoxVisible = true;
}

3
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlView.cs

@ -10,6 +10,7 @@ using System.Collections.Generic; @@ -10,6 +10,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing.Printing;
using System.IO;
using System.Net;
using System.Text;
using System.Windows.Forms;
using System.Xml;
@ -1006,6 +1007,8 @@ namespace ICSharpCode.XmlEditor @@ -1006,6 +1007,8 @@ namespace ICSharpCode.XmlEditor
return true;
} catch(XmlException ex) {
AddTask(xmlEditor.FileName, ex.Message, ex.LinePosition - 1, ex.LineNumber - 1, TaskType.Error);
} catch (WebException ex) {
AddTask(xmlEditor.FileName, ex.Message, 0, 0, TaskType.Error);
}
return false;
}

4
src/AddIns/DisplayBindings/XmlEditor/Test/Utils/MockXmlTreeView.cs

@ -59,6 +59,10 @@ namespace XmlEditor.Tests.Utils @@ -59,6 +59,10 @@ namespace XmlEditor.Tests.Utils
notWellFormedException = ex;
}
public void ShowErrorMessage(string message)
{
}
public bool IsDirty {
get {
return dirty;

Loading…
Cancel
Save