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
foreach (PadDescriptor pd in workbench.PadContentCollection) { foreach (PadDescriptor pd in workbench.PadContentCollection) {
ShowPad(pd); ShowPad(pd);
} }
LoadConfiguration();
} finally { } finally {
Busy = false; Busy = false;
} }
LoadConfiguration();
foreach (AvalonPadContent p in pads.Values) { foreach (AvalonPadContent p in pads.Values) {
p.LoadPadContentIfRequired(); p.LoadPadContentIfRequired();
} }
@ -208,6 +208,7 @@ namespace ICSharpCode.SharpDevelop.Gui
{ {
if (!dockingManager.IsLoaded) if (!dockingManager.IsLoaded)
return; return;
Busy = true;
try { try {
if (File.Exists(LayoutConfiguration.CurrentLayoutFileName)) { if (File.Exists(LayoutConfiguration.CurrentLayoutFileName)) {
dockingManager.RestoreLayout(LayoutConfiguration.CurrentLayoutFileName); dockingManager.RestoreLayout(LayoutConfiguration.CurrentLayoutFileName);
@ -217,6 +218,8 @@ namespace ICSharpCode.SharpDevelop.Gui
} catch (Exception ex) { } catch (Exception ex) {
MessageService.ShowError(ex); MessageService.ShowError(ex);
// ignore errors loading configuration // 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
internal void LoadPadContentIfRequired() 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; placeholder.IsVisibleChanged -= AvalonPadContent_IsVisibleChanged;
padInstance = descriptor.PadContent; padInstance = descriptor.PadContent;
if (padInstance != null) { if (padInstance != null) {

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

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

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

@ -5,24 +5,19 @@
// <version>$Revision$</version> // <version>$Revision$</version>
// </file> // </file>
using ICSharpCode.SharpDevelop.Dom.Refactoring;
using System; using System;
using System.Collections; using System.Collections;
using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.TextEditor;
using ICSharpCode.TextEditor.Document;
using ICSharpCode.TextEditor.Gui.CompletionWindow;
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
{ {
/// <summary> /// <summary>
/// Data provider for code completion. /// Data provider for code completion.
/// </summary> /// </summary>
public class CommentCompletionDataProvider : AbstractCompletionDataProvider public class CommentCompletionDataProvider : AbstractCompletionItemProvider
{ {
int caretLineNumber; static readonly string[][] commentTags = {
int caretColumn;
string[][] commentTags = new string[][] {
new string[] {"c", "marks text as code"}, new string[] {"c", "marks text as code"},
new string[] {"code", "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)"}, 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
new string[] {"value", "A description of a property"} new string[] {"value", "A description of a property"}
}; };
/// <remarks> public override ICompletionItemList GenerateCompletionList(ITextEditor editor)
/// 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)
{ {
caretLineNumber = textArea.Caret.Line; int caretLineNumber = editor.Caret.Line;
caretColumn = textArea.Caret.Column; int caretColumn = editor.Caret.Column;
LineSegment caretLine = textArea.Document.GetLineSegment(caretLineNumber); IDocumentLine caretLine = editor.Document.GetLine(caretLineNumber);
string lineText = textArea.Document.GetText(caretLine.Offset, caretLine.Length); string lineText = caretLine.Text;
if (!lineText.Trim().StartsWith("///") && !lineText.Trim().StartsWith("'''")) { if (!lineText.Trim().StartsWith("///", StringComparison.Ordinal)
&& !lineText.Trim().StartsWith("'''", StringComparison.Ordinal))
{
return null; return null;
} }
ArrayList completionData = new ArrayList(); DefaultCompletionItemList list = new DefaultCompletionItemList();
foreach (string[] tag in commentTags) { foreach (string[] tag in commentTags) {
completionData.Add(new CommentCompletionData(tag[0], tag[1])); list.Items.Add(new DefaultCompletionItem(tag[0]) { Description = 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.SortItems();
return list;
} }
} }
} }

Loading…
Cancel
Save