Skip to content

Commit 4b92fb1

Browse files
committed
Merge pull request #774 from Gama11/VistaFolderNameEditor
Use the VistaFolderBrowserDialog in the settings PropertyGrid
2 parents 9fa3289 + 65682fe commit 4b92fb1

File tree

11 files changed

+50
-11
lines changed

11 files changed

+50
-11
lines changed

External/Plugins/AS2Context/AS2Settings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Windows.Forms.Design;
88
using System.IO;
99
using ASCompletion.Context;
10+
using Ookii.Dialogs;
1011
using PluginCore.Localization;
1112
using PluginCore;
1213

@@ -249,7 +250,7 @@ public string MtascCheckParameters
249250

250251
[DisplayName("Flash IDE Classpath")]
251252
[LocalizedCategory("ASCompletion.Category.Language"), LocalizedDescription("AS2Context.Description.MMClassPath")]
252-
[Editor(typeof(FolderNameEditor), typeof(UITypeEditor))]
253+
[Editor(typeof(VistaFolderNameEditor), typeof(UITypeEditor))]
253254
public string MMClassPath
254255
{
255256
get { return mmClassPath; }

External/Plugins/AS3Context/AS3Settings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using PluginCore.Localization;
88
using PluginCore;
99
using System.IO;
10+
using Ookii.Dialogs;
1011

1112
namespace AS3Context
1213
{
@@ -210,7 +211,7 @@ public string DefaultFlashVersion
210211

211212
[DisplayName("AS3 Classpath")]
212213
[LocalizedCategory("ASCompletion.Category.Language"), LocalizedDescription("AS3Context.Description.AS3Classpath"), DefaultValue(DEFAULT_AS3LIBRARY)]
213-
[Editor(typeof(FolderNameEditor), typeof(UITypeEditor))]
214+
[Editor(typeof(VistaFolderNameEditor), typeof(UITypeEditor))]
214215
public string AS3ClassPath
215216
{
216217
get { return as3ClassPath; }

External/Plugins/ASCompletion/Settings/GeneralSettings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Drawing.Design;
66
using System.Windows.Forms;
77
using System.Windows.Forms.Design;
8+
using Ookii.Dialogs;
89
using PluginCore.Localization;
910

1011
namespace ASCompletion.Settings
@@ -196,7 +197,7 @@ public string AddSpaceAfter
196197

197198
[DisplayName("Path To Flash IDE")]
198199
[LocalizedCategory("ASCompletion.Category.FlashIDE"), LocalizedDescription("ASCompletion.Description.PathToFlashIDE")]
199-
[Editor(typeof(FolderNameEditor), typeof(UITypeEditor))]
200+
[Editor(typeof(VistaFolderNameEditor), typeof(UITypeEditor))]
200201
public string PathToFlashIDE
201202
{
202203
get { return pathToFlashIDE; }

External/Plugins/FileExplorer/Settings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.ComponentModel;
55
using System.Collections.Generic;
66
using System.Windows.Forms.Design;
7+
using Ookii.Dialogs;
78
using PluginCore.Localization;
89

910
namespace FileExplorer
@@ -21,7 +22,7 @@ public class Settings
2122
/// </summary>
2223
[DisplayName("Active Path")]
2324
[LocalizedDescription("FileExplorer.Description.FilePath"), DefaultValue("C:\\")]
24-
[Editor(typeof(FolderNameEditor), typeof(UITypeEditor))]
25+
[Editor(typeof(VistaFolderNameEditor), typeof(UITypeEditor))]
2526
public String FilePath
2627
{
2728
get { return this.filePath; }

External/Plugins/FlashDebugger/Settings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Windows.Forms.Design;
66
using PluginCore.Localization;
77
using LayoutManager.Controls;
8+
using Ookii.Dialogs;
89

910
namespace FlashDebugger
1011
{
@@ -31,7 +32,7 @@ public override String ToString()
3132
return m_Value;
3233
}
3334

34-
[Editor(typeof(FolderNameEditor), typeof(UITypeEditor))]
35+
[Editor(typeof(VistaFolderNameEditor), typeof(UITypeEditor))]
3536
public String Path
3637
{
3738
get { return m_Value; }

External/Plugins/LayoutManager/Settings.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.ComponentModel;
77
using System.Windows.Forms.Design;
88
using System.Collections.Generic;
9+
using Ookii.Dialogs;
910
using PluginCore.Localization;
1011

1112
namespace LayoutManager
@@ -35,7 +36,7 @@ public static Settings Instance
3536
/// </summary>
3637
[DisplayName("Custom Layout File Directory")]
3738
[LocalizedDescription("LayoutManager.Description.CustomLayoutPath"), DefaultValue("")]
38-
[Editor(typeof(FolderNameEditor), typeof(UITypeEditor))]
39+
[Editor(typeof(VistaFolderNameEditor), typeof(UITypeEditor))]
3940
public String CustomLayoutPath
4041
{
4142
get { return this.customLayoutPath; }

External/Plugins/LoomContext/LoomSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public string DefaultFlashVersion
210210
211211
[DisplayName("AS3 Classpath")]
212212
[LocalizedCategory("ASCompletion.Category.Language"), LocalizedDescription("AS3Context.Description.AS3Classpath"), DefaultValue(DEFAULT_AS3LIBRARY)]
213-
[Editor(typeof(FolderNameEditor), typeof(UITypeEditor))]
213+
[Editor(typeof(VistaFolderNameEditor), typeof(UITypeEditor))]
214214
public string AS3ClassPath
215215
{
216216
get { return as3ClassPath; }

FlashDevelop/Settings/Accessors.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.Windows.Forms.Design;
1111
using PluginCore.Localization;
1212
using System.Windows.Forms;
13+
using Ookii.Dialogs;
1314
using PluginCore.Managers;
1415
using ScintillaNet;
1516
using PluginCore;
@@ -753,6 +754,7 @@ public Int32 LatestCommand
753754
[DisplayName("Last Active Path")]
754755
[LocalizedCategory("FlashDevelop.Category.State")]
755756
[LocalizedDescription("FlashDevelop.Description.LatestDialogPath")]
757+
[Editor(typeof(VistaFolderNameEditor), typeof(UITypeEditor))]
756758
public String LatestDialogPath
757759
{
758760
get { return this.latestDialogPath; }
@@ -905,7 +907,7 @@ public String InsertionTriggers
905907
[DisplayName("Custom Snippet Directory")]
906908
[LocalizedCategory("FlashDevelop.Category.Paths")]
907909
[LocalizedDescription("FlashDevelop.Description.CustomSnippetDir")]
908-
[Editor(typeof(FolderNameEditor), typeof(UITypeEditor))]
910+
[Editor(typeof(VistaFolderNameEditor), typeof(UITypeEditor))]
909911
public String CustomSnippetDir
910912
{
911913
get { return this.customSnippetDir; }
@@ -916,7 +918,7 @@ public String CustomSnippetDir
916918
[DisplayName("Custom Template Directory")]
917919
[LocalizedCategory("FlashDevelop.Category.Paths")]
918920
[LocalizedDescription("FlashDevelop.Description.CustomTemplateDir")]
919-
[Editor(typeof(FolderNameEditor), typeof(UITypeEditor))]
921+
[Editor(typeof(VistaFolderNameEditor), typeof(UITypeEditor))]
920922
public String CustomTemplateDir
921923
{
922924
get { return this.customTemplateDir; }
@@ -927,7 +929,7 @@ public String CustomTemplateDir
927929
[DisplayName("Custom Projects Directory")]
928930
[LocalizedCategory("FlashDevelop.Category.Paths")]
929931
[LocalizedDescription("FlashDevelop.Description.CustomProjectsDir")]
930-
[Editor(typeof(FolderNameEditor), typeof(UITypeEditor))]
932+
[Editor(typeof(VistaFolderNameEditor), typeof(UITypeEditor))]
931933
public String CustomProjectsDir
932934
{
933935
get { return this.customProjectsDir; }
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
using System.ComponentModel;
3+
using System.Drawing.Design;
4+
using System.Windows.Forms;
5+
6+
namespace Ookii.Dialogs
7+
{
8+
public class VistaFolderNameEditor : UITypeEditor
9+
{
10+
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
11+
{
12+
return UITypeEditorEditStyle.Modal;
13+
}
14+
15+
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
16+
{
17+
VistaFolderBrowserDialog browser = new VistaFolderBrowserDialog();
18+
if (value != null)
19+
{
20+
browser.SelectedPath = string.Format("{0}", value);
21+
}
22+
23+
if (browser.ShowDialog(null) == DialogResult.OK)
24+
return browser.SelectedPath;
25+
26+
return value;
27+
}
28+
}
29+
}

PluginCore/PluginCore.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@
307307
<Compile Include="Ookii.Dialogs\VistaFolderBrowserDialog.cs">
308308
<SubType>Component</SubType>
309309
</Compile>
310+
<Compile Include="Ookii.Dialogs\VistaFolderNameEditor.cs" />
310311
<Compile Include="PluginCore\Bridge\IBridgeSettings.cs" />
311312
<Compile Include="PluginCore\Controls\Common.cs">
312313
<SubType>Component</SubType>

0 commit comments

Comments
 (0)