forked from fdorg/flashdevelop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettings.cs
More file actions
295 lines (259 loc) · 11.2 KB
/
Copy pathSettings.cs
File metadata and controls
295 lines (259 loc) · 11.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using PluginCore;
using PluginCore.Localization;
using PluginCore.Managers;
using ProjectManager.Controls;
using ProjectManager.Projects;
namespace ProjectManager
{
public delegate void SettingChangeHandler(string setting);
[Serializable]
public class ProjectManagerSettings
{
public event SettingChangeHandler Changed;
private Boolean searchExternalClassPath = true;
List<ProjectPreferences> projectPrefList = new List<ProjectPreferences>();
List<string> recentProjects = new List<string>();
bool showProjectClasspaths = true;
bool showGlobalClasspaths = false;
int maxRecentProjects = 10;
string lastProject = string.Empty;
bool createProjectDirectory = true;
bool useProjectSessions = false;
bool disableExtFlashIntegration = false;
string newProjectDefaultDirectory = string.Empty;
bool enableMxmlMapping = false;
int webserverPort = 2000;
// These are string arrays because they are only edited by the propertygrid (which deals with them nicely)
string[] excludedFileTypes = new string[] { ".p", ".abc", ".bak", ".tmp" };
string[] excludedDirectories = new string[] { ".svn", "_svn", ".cvs", "_cvs", "cvs", "_sgbak", ".git", ".hg", "node_modules" };
string[] executableFileTypes = new string[] { ".exe", ".lnk", ".fla", ".flump", ".doc", ".pps", ".psd", ".png", ".jpg", ".gif", ".xls", ".docproj", ".ttf", ".otf", ".wav", ".mp3", ".ppt", ".pptx", ".docx", ".xlsx", ".ai", ".pdf", ".zip", ".rar" };
string[] filteredDirectoryNames = new string[] { "src", "source", "sources", "as", "as2", "as3", "actionscript", "flash", "classes", "trunk", "svn", "git", "hg", "..", "." };
HighlightType tabHighlightType = HighlightType.ExternalFiles;
#region Properties
[Browsable(false)]
public List<ProjectPreferences> ProjectPrefs
{
get { return projectPrefList; }
set { projectPrefList = value; }
}
[Browsable(false)]
public string LastProject
{
get { return lastProject; }
set { lastProject = value; FireChanged("LastProject"); }
}
[Browsable(false)]
public List<string> RecentProjects
{
get { return recentProjects; }
}
[Browsable(false)]
public bool CreateProjectDirectory
{
get { return createProjectDirectory; }
set { createProjectDirectory = value; FireChanged("CreateProjectDirectory"); }
}
[Browsable(false)]
public String NewProjectDefaultDirectory
{
get { return newProjectDefaultDirectory; }
set { newProjectDefaultDirectory = value; FireChanged("NewProjectDefaultDirectory"); }
}
[DisplayName("Search In External Classpath")]
[LocalizedDescription("ProjectManager.Description.SearchExternalClassPath")]
[LocalizedCategory("ProjectManager.Category.OtherOptions")]
[DefaultValue(true)]
public Boolean SearchExternalClassPath
{
get { return searchExternalClassPath; }
set { searchExternalClassPath = value; }
}
[DisplayName("Use Project Sessions")]
[LocalizedDescription("ProjectManager.Description.UseProjectSessions")]
[LocalizedCategory("ProjectManager.Category.OtherOptions")]
[DefaultValue(false)]
public Boolean UseProjectSessions
{
get { return useProjectSessions; }
set { useProjectSessions = value; }
}
[DisplayName("Maximum Recent Projects")]
[LocalizedDescription("ProjectManager.Description.MaxRecentProjects")]
[LocalizedCategory("ProjectManager.Category.OtherOptions")]
[DefaultValue(10)]
public Int32 MaxRecentProjects
{
get { return maxRecentProjects; }
set { maxRecentProjects = value; FireChanged("MaxRecentProjects"); }
}
[DisplayName("Disable Extended Flash IDE Integration")]
[LocalizedDescription("ProjectManager.Description.DisableExtFlashIntegration")]
[LocalizedCategory("ProjectManager.Category.OtherOptions")]
[DefaultValue(false)]
public bool DisableExtFlashIntegration
{
get { return disableExtFlashIntegration; }
set { disableExtFlashIntegration = value; }
}
[DisplayName("Webserver Port")]
[LocalizedDescription("ProjectManager.Description.WebserverPort")]
[LocalizedCategory("ProjectManager.Category.OtherOptions")]
[DefaultValue(2000)]
public Int32 WebserverPort
{
get { return webserverPort; }
set { webserverPort = value; }
}
[DisplayName("Excluded File Types")]
[LocalizedDescription("ProjectManager.Description.ExcludedFileTypes")]
[LocalizedCategory("ProjectManager.Category.Exclusions")]
public string[] ExcludedFileTypes
{
get { return excludedFileTypes; }
set { excludedFileTypes = value; FireChanged("ExcludedFileTypes"); }
}
[DisplayName("Executable File Types")]
[LocalizedDescription("ProjectManager.Description.ExecutableFileTypes")]
[LocalizedCategory("ProjectManager.Category.Exclusions")]
public string[] ExecutableFileTypes
{
get { return executableFileTypes; }
set { executableFileTypes = value; FireChanged("ExecutableFileTypes"); }
}
[DisplayName("Excluded Directories")]
[LocalizedDescription("ProjectManager.Description.ExcludedDirectories")]
[LocalizedCategory("ProjectManager.Category.Exclusions")]
public string[] ExcludedDirectories
{
get { return excludedDirectories; }
set { excludedDirectories = value; FireChanged("ExcludedDirectories"); }
}
[DisplayName("Filtered Directory Names")]
[LocalizedDescription("ProjectManager.Description.FilteredDirectoryNames")]
[LocalizedCategory("ProjectManager.Category.Exclusions")]
public string[] FilteredDirectoryNames
{
get { return filteredDirectoryNames; }
set { filteredDirectoryNames = value; FireChanged("FilteredDirectoryNames"); }
}
[DisplayName("Show Project Classpaths")]
[LocalizedDescription("ProjectManager.Description.ShowProjectClasspaths")]
[LocalizedCategory("ProjectManager.Category.ProjectTree")]
[DefaultValue(true)]
public bool ShowProjectClasspaths
{
get { return showProjectClasspaths; }
set { showProjectClasspaths = value; FireChanged("ShowProjectClasspaths"); }
}
[DisplayName("Show Global Classpaths")]
[LocalizedDescription("ProjectManager.Description.ShowGlobalClasspaths")]
[LocalizedCategory("ProjectManager.Category.ProjectTree")]
[DefaultValue(false)]
public bool ShowGlobalClasspaths
{
get { return showGlobalClasspaths; }
set { showGlobalClasspaths = value; FireChanged("DisableMxmlMapping"); }
}
[DisplayName("Enable Mxml Sources Mapping")]
[LocalizedDescription("ProjectManager.Description.EnableMxmlMapping")]
[LocalizedCategory("ProjectManager.Category.ProjectTree")]
[DefaultValue(false)]
public bool EnableMxmlMapping
{
get { return enableMxmlMapping; }
set { enableMxmlMapping = value; FireChanged("ShowGlobalClasspaths"); }
}
[DisplayName("Tab Highlight Type")]
[LocalizedDescription("ProjectManager.Description.TabHighlightType")]
[LocalizedCategory("ProjectManager.Category.OtherOptions")]
[DefaultValue(HighlightType.ExternalFiles)]
public HighlightType TabHighlightType
{
get { return tabHighlightType; }
set { tabHighlightType = value; }
}
[DisplayName("Track Active Document")]
[LocalizedDescription("ProjectManager.Description.TrackActiveDocument")]
[LocalizedCategory("ProjectManager.Category.ProjectTree")]
[DefaultValue(false)]
public bool TrackActiveDocument { get; set; }
#endregion
[Browsable(false)]
public string Language;
[Browsable(false)]
public List<string> GlobalClasspaths
{
get { return this.GetGlobalClasspaths(Language); }
set { this.SetGlobalClasspaths(Language, value); }
}
public void SetGlobalClasspaths(String lang, List<String> classpaths)
{
Hashtable info = new Hashtable();
info["language"] = lang;
info["cp"] = classpaths;
DataEvent de = new DataEvent(EventType.Command, "ASCompletion.SetUserClasspath", info);
EventManager.DispatchEvent(this, de);
FireChanged("GlobalClasspath");
}
public List<string> GetGlobalClasspaths(String lang)
{
List<String> cp = null;
Hashtable info = new Hashtable();
info["language"] = lang;
DataEvent de = new DataEvent(EventType.Command, "ASCompletion.GetUserClasspath", info);
EventManager.DispatchEvent(this, de);
if (de.Handled && info.ContainsKey("cp")) cp = info["cp"] as List<string>;
return cp ?? new List<string>();
}
/// <summary>
/// Returns the preferences object for the given project
/// and creates a new instance if necessary.
/// </summary>
public ProjectPreferences GetPrefs(Project project)
{
foreach (ProjectPreferences prefs in projectPrefList)
if (prefs.ProjectPath == project.ProjectPath)
return prefs;
// ok, we haven't seen this project before. let's take this opportunity
// to clean out any prefs for projects that don't exist anymore
CleanOldPrefs();
ProjectPreferences newPrefs = new ProjectPreferences(project.ProjectPath);
newPrefs.DebugMode = project.EnableInteractiveDebugger
&& project.OutputType != OutputType.OtherIDE && project.OutputPath != "";
projectPrefList.Add(newPrefs);
return newPrefs;
}
private void CleanOldPrefs()
{
for (int i = 0; i < projectPrefList.Count; i++)
if (!File.Exists(projectPrefList[i].ProjectPath))
projectPrefList.RemoveAt(i--); // search this index again
}
private void FireChanged(string setting)
{
if (Changed != null)
Changed(setting);
}
}
[Serializable]
public class ProjectPreferences
{
public Boolean DebugMode;
public List<String> ExpandedPaths;
public String ProjectPath;
public String TargetBuild;
public ProjectPreferences()
{
this.ExpandedPaths = new List<String>();
}
public ProjectPreferences(String projectPath) : this()
{
this.ProjectPath = projectPath;
}
}
}