Browse Source

Lazy-loading for IDE option panels.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1949 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
92391e4960
  1. 4
      src/Main/Base/Project/Src/Gui/Dialogs/ProjectOptionsView.cs
  2. 5
      src/Main/Base/Project/Src/Gui/Dialogs/TabbedOptions.cs
  3. 24
      src/Main/Base/Project/Src/Gui/Dialogs/TreeViewOptions.cs
  4. 5
      src/Main/Base/Project/Src/Gui/Dialogs/Wizard/WizardDialog.cs
  5. 14
      src/Main/Base/Project/Src/Internal/Doozers/DefaultDialogPanelDescriptor.cs
  6. 8
      src/Main/Base/Project/Src/Internal/Doozers/DialogPanelDoozer.cs
  7. 6
      src/Main/Base/Project/Src/Internal/Doozers/IDialogPanelDescriptor.cs
  8. 2
      src/Main/Core/Project/Src/AddInTree/AddIn/IDoozer.cs

4
src/Main/Base/Project/Src/Gui/Dialogs/ProjectOptionsView.cs

@ -60,7 +60,7 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs
// tabControl.Alignment = TabAlignment.Left; // tabControl.Alignment = TabAlignment.Left;
tabControl.HandleCreated += TabControlHandleCreated; tabControl.HandleCreated += TabControlHandleCreated;
AddOptionPanels(node.BuildChildItems(this)); AddOptionPanels(node.BuildChildItems<IDialogPanelDescriptor>(this));
} }
void TabControlHandleCreated(object sender, EventArgs e) void TabControlHandleCreated(object sender, EventArgs e)
@ -82,7 +82,7 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs
} }
} }
void AddOptionPanels(ArrayList dialogPanelDescriptors) void AddOptionPanels(IEnumerable<IDialogPanelDescriptor> dialogPanelDescriptors)
{ {
Properties newProperties = new Properties(); Properties newProperties = new Properties();
newProperties.Set("Project", project); newProperties.Set("Project", project);

5
src/Main/Base/Project/Src/Gui/Dialogs/TabbedOptions.cs

@ -9,6 +9,7 @@ using System;
using System.IO; using System.IO;
using System.Drawing; using System.Drawing;
using System.Collections; using System.Collections;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml; using System.Xml;
@ -38,7 +39,7 @@ namespace ICSharpCode.SharpDevelop.Gui
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;
} }
void AddOptionPanels(ArrayList dialogPanelDescriptors) void AddOptionPanels(IEnumerable<IDialogPanelDescriptor> dialogPanelDescriptors)
{ {
foreach (IDialogPanelDescriptor descriptor in dialogPanelDescriptors) { foreach (IDialogPanelDescriptor descriptor in dialogPanelDescriptors) {
if (descriptor != null && descriptor.DialogPanel != null && descriptor.DialogPanel.Control != null) { // may be null, if it is only a "path" if (descriptor != null && descriptor.DialogPanel != null && descriptor.DialogPanel.Control != null) { // may be null, if it is only a "path"
@ -70,7 +71,7 @@ namespace ICSharpCode.SharpDevelop.Gui
Icon = null; Icon = null;
Owner = (Form)WorkbenchSingleton.Workbench; Owner = (Form)WorkbenchSingleton.Workbench;
AddOptionPanels(node.BuildChildItems(this)); AddOptionPanels(node.BuildChildItems<IDialogPanelDescriptor>(this));
} }
} }
} }

24
src/Main/Base/Project/Src/Gui/Dialogs/TreeViewOptions.cs

@ -9,7 +9,7 @@ using System;
using System.IO; using System.IO;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Collections; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml; using System.Xml;
@ -54,7 +54,7 @@ namespace ICSharpCode.SharpDevelop.Gui
{ {
protected GradientHeaderPanel optionsPanelLabel; protected GradientHeaderPanel optionsPanelLabel;
protected ArrayList OptionPanels = new ArrayList(); protected List<IDialogPanel> OptionPanels = new List<IDialogPanel>();
protected Properties properties = null; protected Properties properties = null;
@ -69,7 +69,7 @@ namespace ICSharpCode.SharpDevelop.Gui
protected void AcceptEvent(object sender, EventArgs e) protected void AcceptEvent(object sender, EventArgs e)
{ {
foreach (AbstractOptionPanel pane in OptionPanels) { foreach (IDialogPanel pane in OptionPanels) {
if (!pane.ReceiveDialogMessage(DialogMessage.OK)) { if (!pane.ReceiveDialogMessage(DialogMessage.OK)) {
return; return;
} }
@ -141,6 +141,12 @@ namespace ICSharpCode.SharpDevelop.Gui
{ {
IDialogPanelDescriptor descriptor = node.Tag as IDialogPanelDescriptor; IDialogPanelDescriptor descriptor = node.Tag as IDialogPanelDescriptor;
if (descriptor != null && descriptor.DialogPanel != null && descriptor.DialogPanel.Control != null) { if (descriptor != null && descriptor.DialogPanel != null && descriptor.DialogPanel.Control != null) {
if (!OptionPanels.Contains(descriptor.DialogPanel)) {
descriptor.DialogPanel.CustomizationObject = this.properties;
descriptor.DialogPanel.Control.Dock = DockStyle.Fill;
OptionPanels.Add(descriptor.DialogPanel);
}
descriptor.DialogPanel.ReceiveDialogMessage(DialogMessage.Activated); descriptor.DialogPanel.ReceiveDialogMessage(DialogMessage.Activated);
ControlDictionary["optionControlPanel"].Controls.Clear(); ControlDictionary["optionControlPanel"].Controls.Clear();
RightToLeftConverter.ConvertRecursive(descriptor.DialogPanel.Control); RightToLeftConverter.ConvertRecursive(descriptor.DialogPanel.Control);
@ -157,22 +163,16 @@ namespace ICSharpCode.SharpDevelop.Gui
} }
} }
protected void AddNodes(object customizer, TreeNodeCollection nodes, ArrayList dialogPanelDescriptors) protected void AddNodes(TreeNodeCollection nodes, IEnumerable<IDialogPanelDescriptor> dialogPanelDescriptors)
{ {
nodes.Clear(); nodes.Clear();
foreach (IDialogPanelDescriptor descriptor in dialogPanelDescriptors) { foreach (IDialogPanelDescriptor descriptor in dialogPanelDescriptors) {
if (descriptor.DialogPanel != null) { // may be null, if it is only a "path"
descriptor.DialogPanel.CustomizationObject = customizer;
descriptor.DialogPanel.Control.Dock = DockStyle.Fill;
OptionPanels.Add(descriptor.DialogPanel);
}
TreeNode newNode = new TreeNode(descriptor.Label); TreeNode newNode = new TreeNode(descriptor.Label);
newNode.Tag = descriptor; newNode.Tag = descriptor;
newNode.NodeFont = plainFont; newNode.NodeFont = plainFont;
nodes.Add(newNode); nodes.Add(newNode);
if (descriptor.ChildDialogPanelDescriptors != null) { if (descriptor.ChildDialogPanelDescriptors != null) {
AddNodes(customizer, newNode.Nodes, descriptor.ChildDialogPanelDescriptors); AddNodes(newNode.Nodes, descriptor.ChildDialogPanelDescriptors);
} }
} }
} }
@ -222,7 +222,7 @@ namespace ICSharpCode.SharpDevelop.Gui
InitImageList(); InitImageList();
if (node != null) { if (node != null) {
AddNodes(properties, ((TreeView)ControlDictionary["optionsTreeView"]).Nodes, node.BuildChildItems(this)); AddNodes(((TreeView)ControlDictionary["optionsTreeView"]).Nodes, node.BuildChildItems<IDialogPanelDescriptor>(this));
} }
} }

5
src/Main/Base/Project/Src/Gui/Dialogs/Wizard/WizardDialog.cs

@ -10,6 +10,7 @@ using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Collections; using System.Collections;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml; using System.Xml;
@ -115,7 +116,7 @@ namespace ICSharpCode.SharpDevelop.Gui
finishButton.Enabled = CanFinish; finishButton.Enabled = CanFinish;
} }
void AddNodes(object customizer, ArrayList dialogPanelDescriptors) void AddNodes(object customizer, IEnumerable<IDialogPanelDescriptor> dialogPanelDescriptors)
{ {
foreach (IDialogPanelDescriptor descriptor in dialogPanelDescriptors) { foreach (IDialogPanelDescriptor descriptor in dialogPanelDescriptors) {
@ -198,7 +199,7 @@ namespace ICSharpCode.SharpDevelop.Gui
this.Text = title; this.Text = title;
if (node != null) { if (node != null) {
AddNodes(customizer, node.BuildChildItems(this)); AddNodes(customizer, node.BuildChildItems<IDialogPanelDescriptor>(this));
} }
InitializeComponents(); InitializeComponents();

14
src/Main/Base/Project/Src/Internal/Doozers/DefaultDialogPanelDescriptor.cs

@ -6,7 +6,7 @@
// </file> // </file>
using System; using System;
using System.Collections; using System.Collections.Generic;
using System.CodeDom.Compiler; using System.CodeDom.Compiler;
namespace ICSharpCode.Core namespace ICSharpCode.Core
@ -15,7 +15,7 @@ namespace ICSharpCode.Core
{ {
string id = String.Empty; string id = String.Empty;
string label = String.Empty; string label = String.Empty;
ArrayList dialogPanelDescriptors = null; List<IDialogPanelDescriptor> dialogPanelDescriptors = null;
IDialogPanel dialogPanel = null; IDialogPanel dialogPanel = null;
public string ID { public string ID {
@ -33,13 +33,13 @@ namespace ICSharpCode.Core
} }
} }
public ArrayList ChildDialogPanelDescriptors { public IEnumerable<IDialogPanelDescriptor> ChildDialogPanelDescriptors {
get { get {
return dialogPanelDescriptors; return dialogPanelDescriptors;
} }
set { // set {
dialogPanelDescriptors = value; // dialogPanelDescriptors = value;
} // }
} }
AddIn addin; AddIn addin;
@ -67,7 +67,7 @@ namespace ICSharpCode.Core
this.label = label; this.label = label;
} }
public DefaultDialogPanelDescriptor(string id, string label, ArrayList dialogPanelDescriptors) : this(id, label) public DefaultDialogPanelDescriptor(string id, string label, List<IDialogPanelDescriptor> dialogPanelDescriptors) : this(id, label)
{ {
this.dialogPanelDescriptors = dialogPanelDescriptors; this.dialogPanelDescriptors = dialogPanelDescriptors;
} }

8
src/Main/Base/Project/Src/Internal/Doozers/DialogPanelDoozer.cs

@ -7,6 +7,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic;
using System.Reflection; using System.Reflection;
namespace ICSharpCode.Core namespace ICSharpCode.Core
@ -56,7 +57,12 @@ namespace ICSharpCode.Core
} }
} }
return new DefaultDialogPanelDescriptor(codon.Id, StringParser.Parse(label), subItems); List<IDialogPanelDescriptor> newList = new List<IDialogPanelDescriptor>();
foreach (IDialogPanelDescriptor d in subItems) {
newList.Add(d);
}
return new DefaultDialogPanelDescriptor(codon.Id, StringParser.Parse(label), newList);
} }
} }
} }

6
src/Main/Base/Project/Src/Internal/Doozers/IDialogPanelDescriptor.cs

@ -6,7 +6,7 @@
// </file> // </file>
using System; using System;
using System.Collections; using System.Collections.Generic;
namespace ICSharpCode.Core namespace ICSharpCode.Core
{ {
@ -30,9 +30,8 @@ namespace ICSharpCode.Core
/// <summary> /// <summary>
/// The child dialog panels (e.g. for treeviews) /// The child dialog panels (e.g. for treeviews)
/// </summary> /// </summary>
ArrayList ChildDialogPanelDescriptors { IEnumerable<IDialogPanelDescriptor> ChildDialogPanelDescriptors {
get; get;
set;
} }
/// <value> /// <value>
@ -40,7 +39,6 @@ namespace ICSharpCode.Core
/// </value> /// </value>
IDialogPanel DialogPanel { IDialogPanel DialogPanel {
get; get;
set;
} }
} }
} }

2
src/Main/Core/Project/Src/AddInTree/AddIn/IDoozer.cs

@ -22,6 +22,6 @@ namespace ICSharpCode.Core
/// </summary> /// </summary>
bool HandleConditions { get; } bool HandleConditions { get; }
object BuildItem(object caller, Codon codon, ArrayList subItems); object BuildItem(object caller, /* AddInTreeNode node, */ Codon codon, ArrayList subItems);
} }
} }

Loading…
Cancel
Save