Browse Source

Keep ITextEditor in the IDE (comment out the copy in ICSharpCode.Editor)

newNRvisualizers
Daniel Grunwald 15 years ago
parent
commit
2ce741b35e
  1. 2
      ICSharpCode.Editor/ITextEditor.cs
  2. 40
      ICSharpCode.NRefactory/Documentation/XmlDocumentationProvider.cs
  3. 8
      ICSharpCode.NRefactory/TypeSystem/CecilLoader.cs
  4. 10
      ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultTypeDefinition.cs
  5. 4
      ICSharpCode.NRefactory/TypeSystem/Implementation/SpecializedEvent.cs
  6. 4
      ICSharpCode.NRefactory/TypeSystem/Implementation/SpecializedField.cs
  7. 4
      ICSharpCode.NRefactory/TypeSystem/Implementation/SpecializedMethod.cs
  8. 4
      ICSharpCode.NRefactory/TypeSystem/Implementation/SpecializedProperty.cs

2
ICSharpCode.Editor/ITextEditor.cs

@ -7,6 +7,7 @@ using System.Threading.Tasks; @@ -7,6 +7,7 @@ using System.Threading.Tasks;
namespace ICSharpCode.Editor
{
/*
/// <summary>
/// Interface for text editors.
/// </summary>
@ -64,6 +65,7 @@ namespace ICSharpCode.Editor @@ -64,6 +65,7 @@ namespace ICSharpCode.Editor
/// </remarks>
// Task<bool> ShowLinkedElements(IEnumerable<LinkedElement> linkedElements);
}
*/
/// <summary>
/// Represents the caret in a text editor.

40
ICSharpCode.NRefactory/Documentation/XmlDocumentationProvider.cs

@ -90,22 +90,26 @@ namespace ICSharpCode.NRefactory.Documentation @@ -90,22 +90,26 @@ namespace ICSharpCode.NRefactory.Documentation
if (fileName == null)
throw new ArgumentNullException("fileName");
using (XmlTextReader xmlReader = new XmlTextReader(fileName)) {
xmlReader.XmlResolver = null; // no DTD resolving
xmlReader.MoveToContent();
if (string.IsNullOrEmpty(xmlReader.GetAttribute("redirect"))) {
this.fileName = fileName;
ReadXmlDoc(xmlReader);
} else {
string redirectionTarget = GetRedirectionTarget(xmlReader.GetAttribute("redirect"));
if (redirectionTarget != null) {
Debug.WriteLine("XmlDoc " + fileName + " is redirecting to " + redirectionTarget);
using (XmlTextReader redirectedXmlReader = new XmlTextReader(redirectionTarget)) {
this.fileName = redirectionTarget;
ReadXmlDoc(redirectedXmlReader);
}
using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete)) {
using (XmlTextReader xmlReader = new XmlTextReader(fs)) {
xmlReader.XmlResolver = null; // no DTD resolving
xmlReader.MoveToContent();
if (string.IsNullOrEmpty(xmlReader.GetAttribute("redirect"))) {
this.fileName = fileName;
ReadXmlDoc(xmlReader);
} else {
throw new XmlException("XmlDoc " + fileName + " is redirecting to " + xmlReader.GetAttribute("redirect") + ", but that file was not found.");
string redirectionTarget = GetRedirectionTarget(xmlReader.GetAttribute("redirect"));
if (redirectionTarget != null) {
Debug.WriteLine("XmlDoc " + fileName + " is redirecting to " + redirectionTarget);
using (FileStream redirectedFs = new FileStream(redirectionTarget, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete)) {
using (XmlTextReader redirectedXmlReader = new XmlTextReader(redirectedFs)) {
this.fileName = redirectionTarget;
ReadXmlDoc(redirectedXmlReader);
}
}
} else {
throw new XmlException("XmlDoc " + fileName + " is redirecting to " + xmlReader.GetAttribute("redirect") + ", but that file was not found.");
}
}
}
}
@ -138,7 +142,11 @@ namespace ICSharpCode.NRefactory.Documentation @@ -138,7 +142,11 @@ namespace ICSharpCode.NRefactory.Documentation
return dir + Path.DirectorySeparatorChar;
}
internal static string LookupLocalizedXmlDoc(string fileName)
/// <summary>
/// Given the assembly file name, looks up the XML documentation file name.
/// Returns null if no XML documentation file is found.
/// </summary>
public static string LookupLocalizedXmlDoc(string fileName)
{
string xmlFileName = Path.ChangeExtension(fileName, ".xml");
string currentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName;

8
ICSharpCode.NRefactory/TypeSystem/CecilLoader.cs

@ -8,6 +8,7 @@ using System.Diagnostics; @@ -8,6 +8,7 @@ using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
using ICSharpCode.NRefactory.TypeSystem.Implementation;
using Mono.Cecil;
@ -44,6 +45,11 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -44,6 +45,11 @@ namespace ICSharpCode.NRefactory.TypeSystem
/// </summary>
public IInterningProvider InterningProvider { get; set; }
/// <summary>
/// Gets/Sets the cancellation token used by the cecil loader.
/// </summary>
public CancellationToken CancellationToken { get; set; }
/// <summary>
/// Gets a value indicating whether this instance stores references to the cecil objects.
/// </summary>
@ -91,6 +97,7 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -91,6 +97,7 @@ namespace ICSharpCode.NRefactory.TypeSystem
List<CecilTypeDefinition> types = new List<CecilTypeDefinition>();
foreach (ModuleDefinition module in assemblyDefinition.Modules) {
foreach (TypeDefinition td in module.Types) {
this.CancellationToken.ThrowIfCancellationRequested();
if (this.IncludeInternalMembers || (td.Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.Public) {
string name = td.FullName;
if (name.Length == 0 || name[0] == '<')
@ -719,6 +726,7 @@ namespace ICSharpCode.NRefactory.TypeSystem @@ -719,6 +726,7 @@ namespace ICSharpCode.NRefactory.TypeSystem
public void Init(CecilLoader loader)
{
loader.CancellationToken.ThrowIfCancellationRequested();
InitModifiers();
if (typeDefinition.HasGenericParameters) {

10
ICSharpCode.NRefactory/TypeSystem/Implementation/DefaultTypeDefinition.cs

@ -265,7 +265,15 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -265,7 +265,15 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
}
public virtual string Documentation {
get { return null; }
get {
// To save memory, we don't store the documentation provider within the type,
// but use our the project content as a documentation provider:
IDocumentationProvider provider = projectContent as IDocumentationProvider;
if (provider != null)
return provider.GetDocumentation(this);
else
return null;
}
}
public Accessibility Accessibility {

4
ICSharpCode.NRefactory/TypeSystem/Implementation/SpecializedEvent.cs

@ -33,6 +33,10 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -33,6 +33,10 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
get { return memberDefinition; }
}
public override string Documentation {
get { return memberDefinition.Documentation; }
}
public override int GetHashCode()
{
int hashCode = 0;

4
ICSharpCode.NRefactory/TypeSystem/Implementation/SpecializedField.cs

@ -33,6 +33,10 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -33,6 +33,10 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
get { return memberDefinition; }
}
public override string Documentation {
get { return memberDefinition.Documentation; }
}
public override int GetHashCode()
{
int hashCode = 0;

4
ICSharpCode.NRefactory/TypeSystem/Implementation/SpecializedMethod.cs

@ -33,6 +33,10 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -33,6 +33,10 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
get { return memberDefinition; }
}
public override string Documentation {
get { return memberDefinition.Documentation; }
}
public override int GetHashCode()
{
int hashCode = 0;

4
ICSharpCode.NRefactory/TypeSystem/Implementation/SpecializedProperty.cs

@ -33,6 +33,10 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation @@ -33,6 +33,10 @@ namespace ICSharpCode.NRefactory.TypeSystem.Implementation
get { return memberDefinition; }
}
public override string Documentation {
get { return memberDefinition.Documentation; }
}
public override int GetHashCode()
{
int hashCode = 0;

Loading…
Cancel
Save