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

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

@ -9,6 +9,7 @@ using System; @@ -9,6 +9,7 @@ using System;
using System.IO;
using System.Drawing;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Xml;
@ -38,7 +39,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -38,7 +39,7 @@ namespace ICSharpCode.SharpDevelop.Gui
DialogResult = DialogResult.OK;
}
void AddOptionPanels(ArrayList dialogPanelDescriptors)
void AddOptionPanels(IEnumerable<IDialogPanelDescriptor> 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"
@ -70,7 +71,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -70,7 +71,7 @@ namespace ICSharpCode.SharpDevelop.Gui
Icon = null;
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; @@ -9,7 +9,7 @@ using System;
using System.IO;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Xml;
@ -54,7 +54,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -54,7 +54,7 @@ namespace ICSharpCode.SharpDevelop.Gui
{
protected GradientHeaderPanel optionsPanelLabel;
protected ArrayList OptionPanels = new ArrayList();
protected List<IDialogPanel> OptionPanels = new List<IDialogPanel>();
protected Properties properties = null;
@ -69,7 +69,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -69,7 +69,7 @@ namespace ICSharpCode.SharpDevelop.Gui
protected void AcceptEvent(object sender, EventArgs e)
{
foreach (AbstractOptionPanel pane in OptionPanels) {
foreach (IDialogPanel pane in OptionPanels) {
if (!pane.ReceiveDialogMessage(DialogMessage.OK)) {
return;
}
@ -141,6 +141,12 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -141,6 +141,12 @@ namespace ICSharpCode.SharpDevelop.Gui
{
IDialogPanelDescriptor descriptor = node.Tag as IDialogPanelDescriptor;
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);
ControlDictionary["optionControlPanel"].Controls.Clear();
RightToLeftConverter.ConvertRecursive(descriptor.DialogPanel.Control);
@ -157,22 +163,16 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -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();
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);
newNode.Tag = descriptor;
newNode.NodeFont = plainFont;
nodes.Add(newNode);
if (descriptor.ChildDialogPanelDescriptors != null) {
AddNodes(customizer, newNode.Nodes, descriptor.ChildDialogPanelDescriptors);
AddNodes(newNode.Nodes, descriptor.ChildDialogPanelDescriptors);
}
}
}
@ -222,7 +222,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -222,7 +222,7 @@ namespace ICSharpCode.SharpDevelop.Gui
InitImageList();
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; @@ -10,6 +10,7 @@ using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Xml;
@ -115,7 +116,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -115,7 +116,7 @@ namespace ICSharpCode.SharpDevelop.Gui
finishButton.Enabled = CanFinish;
}
void AddNodes(object customizer, ArrayList dialogPanelDescriptors)
void AddNodes(object customizer, IEnumerable<IDialogPanelDescriptor> dialogPanelDescriptors)
{
foreach (IDialogPanelDescriptor descriptor in dialogPanelDescriptors) {
@ -198,7 +199,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -198,7 +199,7 @@ namespace ICSharpCode.SharpDevelop.Gui
this.Text = title;
if (node != null) {
AddNodes(customizer, node.BuildChildItems(this));
AddNodes(customizer, node.BuildChildItems<IDialogPanelDescriptor>(this));
}
InitializeComponents();

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

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

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

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

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

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

Loading…
Cancel
Save