~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/Main/Base/Project/Src/Internal/Doozers/DefaultOptionPanelDescriptor.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.Collections.Generic;
 
6
using ICSharpCode.Core;
 
7
 
 
8
namespace ICSharpCode.SharpDevelop
 
9
{
 
10
        public class DefaultOptionPanelDescriptor : IOptionPanelDescriptor
 
11
        {
 
12
                string       id    = String.Empty;
 
13
                List<IOptionPanelDescriptor> optionPanelDescriptors = null;
 
14
                IOptionPanel optionPanel = null;
 
15
                
 
16
                public string ID {
 
17
                        get {
 
18
                                return id;
 
19
                        }
 
20
                }
 
21
                
 
22
                public string Label { get; set; }
 
23
                
 
24
                public IEnumerable<IOptionPanelDescriptor> ChildOptionPanelDescriptors {
 
25
                        get {
 
26
                                return optionPanelDescriptors;
 
27
                        }
 
28
                }
 
29
                
 
30
                AddIn addin;
 
31
                object owner;
 
32
                string optionPanelPath;
 
33
                
 
34
                public IOptionPanel OptionPanel {
 
35
                        get {
 
36
                                if (optionPanelPath != null) {
 
37
                                        if (optionPanel == null) {
 
38
                                                optionPanel = (IOptionPanel)addin.CreateObject(optionPanelPath);
 
39
                                                if (optionPanel != null) {
 
40
                                                        optionPanel.Owner = owner;
 
41
                                                }
 
42
                                        }
 
43
                                        optionPanelPath = null;
 
44
                                        addin = null;
 
45
                                }
 
46
                                return optionPanel;
 
47
                        }
 
48
                }
 
49
                
 
50
                public bool HasOptionPanel {
 
51
                        get {
 
52
                                return optionPanelPath != null;
 
53
                        }
 
54
                }
 
55
                
 
56
                public DefaultOptionPanelDescriptor(string id, string label)
 
57
                {
 
58
                        this.id    = id;
 
59
                        this.Label = label;
 
60
                }
 
61
                
 
62
                public DefaultOptionPanelDescriptor(string id, string label, List<IOptionPanelDescriptor> dialogPanelDescriptors) : this(id, label)
 
63
                {
 
64
                        this.optionPanelDescriptors = dialogPanelDescriptors;
 
65
                }
 
66
                
 
67
                public DefaultOptionPanelDescriptor(string id, string label, AddIn addin, object owner, string optionPanelPath) : this(id, label)
 
68
                {
 
69
                        this.addin = addin;
 
70
                        this.owner = owner;
 
71
                        this.optionPanelPath = optionPanelPath;
 
72
                }
 
73
        }
 
74
}