Actionの非常駐インスタンス化
履歴ビューの更新条件の改善(外部ツールなど)
@@ -0,0 +1,188 @@ | ||
1 | +using System; | |
2 | +using System.Collections.Generic; | |
3 | +using System.Text; | |
4 | + | |
5 | +namespace SCFiler2.Operation { | |
6 | + /// <summary> | |
7 | + /// 全てのAction(およびActionの子クラス)を管理する | |
8 | + /// シングルトン | |
9 | + /// </summary> | |
10 | + public class ActionManager { | |
11 | + static private ActionManager instance = new ActionManager(); | |
12 | + static public ActionManager Instance { | |
13 | + get { return instance;} | |
14 | + } | |
15 | + | |
16 | + private ActionManager () { | |
17 | + } | |
18 | + | |
19 | + public enum ActionID : int { | |
20 | + //FileOperation | |
21 | + CopyToAnotherFileView = 1, | |
22 | + CopyDialog, | |
23 | + MoveDialog, | |
24 | + MoveToAnothierFileView, | |
25 | + MoveToRecycle, | |
26 | + DeleteSelectedItem, | |
27 | + ExecuteFocusedItem, | |
28 | + OpenByExplorer, | |
29 | + CreateFolder, | |
30 | + Rename, | |
31 | + CopyToClipboard, | |
32 | + CutToClipboard, | |
33 | + ClearClipboard, | |
34 | + PasteClipboard, | |
35 | + FileSearch, | |
36 | + | |
37 | + | |
38 | + //View | |
39 | + setFocusToLeftFileView, | |
40 | + setFocusToRightFileView, | |
41 | + GoToSameFolderAsAnotherView, | |
42 | + IncrementalSearch, | |
43 | + MigemoSearch, | |
44 | + EasySelect, | |
45 | + SelectAll, | |
46 | + RefleshAll, | |
47 | + PreviewMode, | |
48 | + Sort, | |
49 | + | |
50 | + //Application | |
51 | + ExitApplication, | |
52 | + MinimizeApplication, | |
53 | + | |
54 | + //Move | |
55 | + MoveToParentFolder, | |
56 | + MoveToDriveRoot, | |
57 | + MoveBackword, | |
58 | + MoveForword, | |
59 | + AddToJumpFolder, | |
60 | + GoToJumpFolder, | |
61 | + | |
62 | + //Tool | |
63 | + ExecuteExternalTool1, | |
64 | + ExecuteExternalTool2, | |
65 | + ExecuteExternalTool3, | |
66 | + ExecuteExternalTool4, | |
67 | + ExecuteExternalTool5 | |
68 | + } | |
69 | + | |
70 | + /// <summary> | |
71 | + /// 1つのActionの管理情報を持っているクラス | |
72 | + /// </summary> | |
73 | + private class ActionManageUnit { | |
74 | + public ActionManageUnit(ActionID id, string displayString) { | |
75 | + this.id = id; | |
76 | + this.displayString = displayString; | |
77 | + } | |
78 | + public ActionID id; | |
79 | + public string displayString; | |
80 | + } | |
81 | + | |
82 | + static public IEnumerable<ActionID> AllActionID { | |
83 | + get { | |
84 | + foreach (ActionID id in Enum.GetValues(typeof(ActionID))) { | |
85 | + yield return id; | |
86 | + } | |
87 | + } | |
88 | + } | |
89 | + | |
90 | + static public string GetDisplayString(ActionID id) { | |
91 | + return CreateAction(id).DisplayString; | |
92 | + } | |
93 | + | |
94 | + static public Action CreateAction(ActionID id) { | |
95 | + switch (id) { | |
96 | + //FileOperation | |
97 | + case ActionID.CopyToAnotherFileView: | |
98 | + return new CopyToAnotherFileVIew(); | |
99 | + case ActionID.CopyDialog: | |
100 | + return new CopyDialog(); | |
101 | + case ActionID.MoveDialog: | |
102 | + return new MoveDialog(); | |
103 | + case ActionID.MoveToAnothierFileView: | |
104 | + return new MoveToAnotherFileView(); | |
105 | + case ActionID.MoveToRecycle: | |
106 | + return new MoveToRecycle(); | |
107 | + case ActionID.DeleteSelectedItem: | |
108 | + return new DeleteSelectedItem(); | |
109 | + case ActionID.ExecuteFocusedItem: | |
110 | + return new ExecuteFocusedItem(); | |
111 | + case ActionID.OpenByExplorer: | |
112 | + return new OpenByExplorer(); | |
113 | + case ActionID.CreateFolder: | |
114 | + return new CreateFolder(); | |
115 | + case ActionID.Rename: | |
116 | + return new Rename(); | |
117 | + case ActionID.CopyToClipboard: | |
118 | + return new CopyToClipboard(); | |
119 | + case ActionID.CutToClipboard: | |
120 | + return new CutToClipboard(); | |
121 | + case ActionID.ClearClipboard: | |
122 | + return new ClearClipboard(); | |
123 | + case ActionID.PasteClipboard: | |
124 | + return new PasteClipboard(); | |
125 | + | |
126 | + //View | |
127 | + case ActionID.setFocusToLeftFileView: | |
128 | + return new setFocusToLeftFileView(); | |
129 | + case ActionID.setFocusToRightFileView: | |
130 | + return new setFocusToRightFileView(); | |
131 | + case ActionID.GoToSameFolderAsAnotherView: | |
132 | + return new GoToSameFolderAsAnotherView(); | |
133 | + case ActionID.IncrementalSearch: | |
134 | + return new IncrementalSearch(); | |
135 | + case ActionID.MigemoSearch: | |
136 | + return new MigemoSearch(); | |
137 | + case ActionID.FileSearch: | |
138 | + return new FileSearch(); | |
139 | + case ActionID.EasySelect: | |
140 | + return new EasySelect(); | |
141 | + case ActionID.SelectAll: | |
142 | + return new SelectAll(); | |
143 | + case ActionID.RefleshAll: | |
144 | + return new RefleshAll(); | |
145 | + case ActionID.PreviewMode: | |
146 | + return new PreviewMode(); | |
147 | + case ActionID.Sort: | |
148 | + return new Sort(); | |
149 | + | |
150 | + //Application | |
151 | + case ActionID.ExitApplication: | |
152 | + return new ExitApplication(); | |
153 | + case ActionID.MinimizeApplication: | |
154 | + return new MinimizeApplication(); | |
155 | + | |
156 | + //Move | |
157 | + case ActionID.MoveToParentFolder: | |
158 | + return new MoveToParentFolder(); | |
159 | + case ActionID.MoveToDriveRoot: | |
160 | + return new MoveToDriveRoot(); | |
161 | + case ActionID.MoveBackword: | |
162 | + return new MoveBackword(); | |
163 | + case ActionID.MoveForword: | |
164 | + return new MoveForword(); | |
165 | + case ActionID.AddToJumpFolder: | |
166 | + return new AddToJumpFolder(); | |
167 | + case ActionID.GoToJumpFolder: | |
168 | + return new GoToJumpFolder(); | |
169 | + | |
170 | + //Tool | |
171 | + case ActionID.ExecuteExternalTool1: | |
172 | + return new ExecuteExternalTool1(); | |
173 | + case ActionID.ExecuteExternalTool2: | |
174 | + return new ExecuteExternalTool2(); | |
175 | + case ActionID.ExecuteExternalTool3: | |
176 | + return new ExecuteExternalTool3(); | |
177 | + case ActionID.ExecuteExternalTool4: | |
178 | + return new ExecuteExternalTool4(); | |
179 | + case ActionID.ExecuteExternalTool5: | |
180 | + return new ExecuteExternalTool5(); | |
181 | + default: | |
182 | + System.Diagnostics.Debug.Assert(false, "ActionManager:対応するActionがありません"); | |
183 | + return null; | |
184 | + } | |
185 | + | |
186 | + } | |
187 | + } | |
188 | +} |