Browse Source

Don't initialize pads before the docking layout has been loaded.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3970 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
5580bf4de8
  1. 5
      src/Main/Base/Project/Src/Gui/Workbench/Layouts/AvalonDockLayout.cs
  2. 3
      src/Main/Base/Project/Src/Gui/Workbench/Layouts/AvalonPadContent.cs
  3. 2
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/CodeCompletionBinding.cs
  4. 85
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CommentCompletionDataProvider.cs

5
src/Main/Base/Project/Src/Gui/Workbench/Layouts/AvalonDockLayout.cs

@ -99,10 +99,10 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -99,10 +99,10 @@ namespace ICSharpCode.SharpDevelop.Gui
foreach (PadDescriptor pd in workbench.PadContentCollection) {
ShowPad(pd);
}
LoadConfiguration();
} finally {
Busy = false;
}
LoadConfiguration();
foreach (AvalonPadContent p in pads.Values) {
p.LoadPadContentIfRequired();
}
@ -208,6 +208,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -208,6 +208,7 @@ namespace ICSharpCode.SharpDevelop.Gui
{
if (!dockingManager.IsLoaded)
return;
Busy = true;
try {
if (File.Exists(LayoutConfiguration.CurrentLayoutFileName)) {
dockingManager.RestoreLayout(LayoutConfiguration.CurrentLayoutFileName);
@ -217,6 +218,8 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -217,6 +218,8 @@ namespace ICSharpCode.SharpDevelop.Gui
} catch (Exception ex) {
MessageService.ShowError(ex);
// ignore errors loading configuration
} finally {
Busy = false;
}
}

3
src/Main/Base/Project/Src/Gui/Workbench/Layouts/AvalonPadContent.cs

@ -47,7 +47,8 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -47,7 +47,8 @@ namespace ICSharpCode.SharpDevelop.Gui
internal void LoadPadContentIfRequired()
{
if (placeholder != null && placeholder.IsVisible && !layout.Busy) {
bool dockingManagerIsInitializing = layout.Busy || !layout.DockingManager.IsLoaded;
if (placeholder != null && placeholder.IsVisible && !dockingManagerIsInitializing) {
placeholder.IsVisibleChanged -= AvalonPadContent_IsVisibleChanged;
padInstance = descriptor.PadContent;
if (padInstance != null) {

2
src/Main/Base/Project/Src/TextEditor/Gui/Editor/CodeCompletionBinding.cs

@ -184,7 +184,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -184,7 +184,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
break;
case '<':
if (enableXmlCommentCompletion) {
editor.ShowCompletionWindow(new CommentCompletionDataProvider(), ch);
new CommentCompletionDataProvider().ShowCompletion(editor);
return CodeCompletionKeyPressResult.Completed;
}
break;

85
src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CommentCompletionDataProvider.cs

@ -5,24 +5,19 @@ @@ -5,24 +5,19 @@
// <version>$Revision$</version>
// </file>
using ICSharpCode.SharpDevelop.Dom.Refactoring;
using System;
using System.Collections;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.TextEditor;
using ICSharpCode.TextEditor.Document;
using ICSharpCode.TextEditor.Gui.CompletionWindow;
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
{
/// <summary>
/// Data provider for code completion.
/// </summary>
public class CommentCompletionDataProvider : AbstractCompletionDataProvider
public class CommentCompletionDataProvider : AbstractCompletionItemProvider
{
int caretLineNumber;
int caretColumn;
string[][] commentTags = new string[][] {
static readonly string[][] commentTags = {
new string[] {"c", "marks text as code"},
new string[] {"code", "marks text as code"},
new string[] {"example", "A description of the code example\n(must have a <code> tag inside)"},
@ -46,74 +41,24 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -46,74 +41,24 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
new string[] {"value", "A description of a property"}
};
/// <remarks>
/// Returns true, if the given coordinates (row, column) are in the region.
/// </remarks>
bool IsBetween(int row, int column, DomRegion region)
{
return row >= region.BeginLine && (row <= region.EndLine || region.EndLine == -1);
}
public override ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
public override ICompletionItemList GenerateCompletionList(ITextEditor editor)
{
caretLineNumber = textArea.Caret.Line;
caretColumn = textArea.Caret.Column;
LineSegment caretLine = textArea.Document.GetLineSegment(caretLineNumber);
string lineText = textArea.Document.GetText(caretLine.Offset, caretLine.Length);
if (!lineText.Trim().StartsWith("///") && !lineText.Trim().StartsWith("'''")) {
int caretLineNumber = editor.Caret.Line;
int caretColumn = editor.Caret.Column;
IDocumentLine caretLine = editor.Document.GetLine(caretLineNumber);
string lineText = caretLine.Text;
if (!lineText.Trim().StartsWith("///", StringComparison.Ordinal)
&& !lineText.Trim().StartsWith("'''", StringComparison.Ordinal))
{
return null;
}
ArrayList completionData = new ArrayList();
DefaultCompletionItemList list = new DefaultCompletionItemList();
foreach (string[] tag in commentTags) {
completionData.Add(new CommentCompletionData(tag[0], tag[1]));
}
return (ICompletionData[])completionData.ToArray(typeof(ICompletionData));
}
class CommentCompletionData : ICompletionData
{
string text;
string description;
public int ImageIndex {
get {
return ClassBrowserIconService.MethodIndex;
}
}
public string Text {
get {
return text;
}
set {
text = value;
}
}
public string Description {
get {
return description;
}
}
public double Priority {
get {
return 0;
}
}
public bool InsertAction(TextArea textArea, char ch)
{
textArea.InsertString(text);
return false;
}
public CommentCompletionData(string text, string description)
{
this.text = text;
this.description = description;
list.Items.Add(new DefaultCompletionItem(tag[0]) { Description = tag[1] });
}
list.SortItems();
return list;
}
}
}

Loading…
Cancel
Save