~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ReferencePaths.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 ICSharpCode.Core;
 
6
using ICSharpCode.SharpDevelop.Project;
 
7
 
 
8
namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
 
9
{
 
10
        public class ReferencePaths : AbstractXmlFormsProjectOptionPanel
 
11
        {
 
12
                public override void LoadPanelContents()
 
13
                {
 
14
                        InitializeHelper();
 
15
                        
 
16
                        StringListEditor editor = new StringListEditor();
 
17
                        editor.BrowseForDirectory = true;
 
18
                        editor.ListCaption = StringParser.Parse("&${res:Dialog.ProjectOptions.ReferencePaths}:");
 
19
                        editor.TitleText = StringParser.Parse("&${res:Dialog.ExportProjectToHtml.FolderLabel}");
 
20
                        editor.AddButtonText = StringParser.Parse("${res:Dialog.ProjectOptions.ReferencePaths.AddPath}");
 
21
                        editor.ListChanged += delegate { IsDirty = true; };
 
22
                        SemicolonSeparatedStringListBinding b = new SemicolonSeparatedStringListBinding(editor);
 
23
                        helper.AddBinding("ReferencePath", b);
 
24
                        this.Controls.Add(editor);
 
25
                        b.CreateLocationButton(editor);
 
26
                        
 
27
                        helper.AddConfigurationSelector(this);
 
28
                }
 
29
                
 
30
                sealed class SemicolonSeparatedStringListBinding : ConfigurationGuiBinding
 
31
                {
 
32
                        StringListEditor editor;
 
33
                        
 
34
                        public SemicolonSeparatedStringListBinding(StringListEditor editor)
 
35
                        {
 
36
                                this.editor = editor;
 
37
                        }
 
38
                        
 
39
                        public override void Load()
 
40
                        {
 
41
                                string[] values = Get("").Split(';');
 
42
                                if (values.Length == 1 && values[0].Length == 0) {
 
43
                                        editor.LoadList(new string[0]);
 
44
                                } else {
 
45
                                        editor.LoadList(values);
 
46
                                }
 
47
                        }
 
48
                        
 
49
                        public override bool Save()
 
50
                        {
 
51
                                Set(string.Join(";", editor.GetList()));
 
52
                                return true;
 
53
                        }
 
54
                }
 
55
        }
 
56
}