Browse Source

SD2-534: Quick XML Doc menu option does nothing; added vb.net support

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@708 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Markus Palme 20 years ago
parent
commit
85a90c9cee
  1. 133
      src/Main/Base/Project/Src/TextEditor/Commands/ToolCommands.cs

133
src/Main/Base/Project/Src/TextEditor/Commands/ToolCommands.cs

@ -17,6 +17,7 @@ using System.Diagnostics;
using System.Text; using System.Text;
using System.Xml; using System.Xml;
using System.Xml.Xsl; using System.Xml.Xsl;
using System.Xml.XPath;
using ICSharpCode.Core; using ICSharpCode.Core;
@ -74,67 +75,77 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
{ {
public override void Run() public override void Run()
{ {
// TODO: New Projectfile system. IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
// IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow; if (window == null || !(window.ViewContent is ITextEditorControlProvider)) {
// return;
// if (window == null || !(window.ViewContent is ITextEditorControlProvider)) { }
// return; TextEditorControl textAreaControl = ((ITextEditorControlProvider)window.ViewContent).TextEditorControl;
// }
// TextEditorControl textAreaControl = ((ITextEditorControlProvider)window.ViewContent).TextEditorControl; int startLine = textAreaControl.Document.GetLineNumberForOffset(textAreaControl.ActiveTextAreaControl.Caret.Offset);
// int endLine = startLine;
// int startLine = textAreaControl.Document.GetLineNumberForOffset(textAreaControl.ActiveTextAreaControl.Caret.Offset);
// int endLine = startLine; LineSegment line = textAreaControl.Document.GetLineSegment(startLine);
// string curLine = textAreaControl.Document.GetText(line.Offset, line.Length).Trim();
// LineSegment line = textAreaControl.Document.GetLineSegment(startLine); if (!curLine.StartsWith("///") && ! curLine.StartsWith("'@")) {
// string curLine = textAreaControl.Document.GetText(line.Offset, line.Length).Trim(); return;
// if (!curLine.StartsWith("///")) { }
// return;
// } while (startLine > 0) {
// line = textAreaControl.Document.GetLineSegment(startLine);
// while (startLine > 0) { curLine = textAreaControl.Document.GetText(line.Offset, line.Length).Trim();
// line = textAreaControl.Document.GetLineSegment(startLine); if (curLine.StartsWith("///") || curLine.StartsWith("'@")) {
// curLine = textAreaControl.Document.GetText(line.Offset, line.Length).Trim(); --startLine;
// if (curLine.StartsWith("///")) { } else {
// --startLine; break;
// } else { }
// break; }
// }
// } while (endLine < textAreaControl.Document.TotalNumberOfLines - 1) {
// line = textAreaControl.Document.GetLineSegment(endLine);
// while (endLine < textAreaControl.Document.TotalNumberOfLines - 1) { curLine = textAreaControl.Document.GetText(line.Offset, line.Length).Trim();
// line = textAreaControl.Document.GetLineSegment(endLine); if (curLine.StartsWith("///") || curLine.StartsWith("'@")) {
// curLine = textAreaControl.Document.GetText(line.Offset, line.Length).Trim(); ++endLine;
// if (curLine.StartsWith("///")) { } else {
// ++endLine; break;
// } else { }
// break; }
// }
// } StringBuilder documentation = new StringBuilder();
// for (int lineNr = startLine + 1; lineNr < endLine; ++lineNr) {
// StringBuilder documentation = new StringBuilder(); line = textAreaControl.Document.GetLineSegment(lineNr);
// for (int lineNr = startLine + 1; lineNr < endLine; ++lineNr) { curLine = textAreaControl.Document.GetText(line.Offset, line.Length).Trim();
// line = textAreaControl.Document.GetLineSegment(lineNr); if(curLine.StartsWith("///")) {
// curLine = textAreaControl.Document.GetText(line.Offset, line.Length).Trim(); documentation.Append(curLine.Substring(3));
// documentation.Append(curLine.Substring(3)); }
// documentation.Append('\n'); else
// } {
// string xml = "<member>" + documentation.ToString() + "</member>"; documentation.Append(curLine.Substring(2));
// }
// string html = String.Empty; documentation.Append('\n');
// }
// try { string xml = "<member>" + documentation.ToString() + "</member>";
// string html = String.Empty;
//
// html = ICSharpCode.SharpDevelop.Internal.Project.ConvertXml.ConvertData(xml, try
// PropertyService.DataDirectory + {
// Path.DirectorySeparatorChar + "ConversionStyleSheets" + XslCompiledTransform t = new XslCompiledTransform();
// Path.DirectorySeparatorChar + "ShowXmlDocumentation.xsl", t.Load(Path.Combine(Path.Combine(PropertyService.DataDirectory, "ConversionStyleSheets"), "ShowXmlDocumentation.xsl"));
// null); XmlDocument doc = new XmlDocument();
// } catch (Exception e) { doc.LoadXml(xml);
// MessageBox.Show(e.ToString()); StringBuilder sb = new StringBuilder();
// } TextWriter textWriter = new StringWriter(sb);
// new ToolWindowForm(textAreaControl, html).Show(); XmlWriter writer = new XmlTextWriter(textWriter);
t.Transform(doc, writer);
html = sb.ToString();
textWriter.Close();
writer.Close();
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
new ToolWindowForm(textAreaControl, html).Show();
} }
class ToolWindowForm : Form class ToolWindowForm : Form

Loading…
Cancel
Save