File tree Expand file tree Collapse file tree
src/com/dengzii/plugin/auc Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828
2929 <actions >
3030 <!-- Add your actions here -->
31- <action id =" com.dengzii.plugin.auc.gen" class =" com.dengzii.plugin.auc.AucFrameGen " text =" AucFrameGenerator"
31+ <action id =" com.dengzii.plugin.auc.gen" class =" com.dengzii.plugin.auc.AucFrameGenAction " text =" AucFrameGenerator"
3232 description =" AucFrameGenerator" >
3333 <add-to-group group-id =" ProjectViewPopupMenu" anchor =" first" />
3434 </action >
Original file line number Diff line number Diff line change @@ -2,24 +2,23 @@ package com.dengzii.plugin.auc
22
33import com.intellij.openapi.actionSystem.AnAction
44import com.intellij.openapi.actionSystem.AnActionEvent
5- import com.intellij.openapi.command.WriteCommandAction
65
76/* *
87 * <pre>
98 * author : dengzi
109 * e-mail : denua@foxmail.com
11- * github : https://github.com/MrDenua
10+ * github : https://github.com/dengzii
1211 * time : 2019/12/31
1312 * desc :
1413</pre> *
1514 */
16- class AucFrameGen : AnAction () {
15+ class AucFrameGenAction : AnAction () {
1716 override fun actionPerformed (e : AnActionEvent ) {
1817 val kit = PluginKit .get(e)
1918 if (! kit.isProjectValid()) {
2019 return
2120 }
22- WriteCommandAction .writeCommandAction (kit.project). run ( FileWriteAction (kit) )
21+ FileWriteCommand .startAction (kit)
2322 }
2423
2524}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ package com.dengzii.plugin.auc
2+
3+ import com.intellij.openapi.command.WriteCommandAction
4+ import com.intellij.util.ThrowableRunnable
5+
6+ /* *
7+ * <pre>
8+ * author : dengzi
9+ * e-mail : denua@foxmail.com
10+ * github : https://github.com/dengzii
11+ * time : 2019/12/31
12+ * desc :
13+ * </pre>
14+ */
15+ class FileWriteCommand (private var kit : PluginKit ) : ThrowableRunnable<RuntimeException> {
16+
17+ companion object {
18+ fun startAction (kit : PluginKit ) {
19+ WriteCommandAction .writeCommandAction(kit.project).run (FileWriteCommand (kit))
20+ }
21+ }
22+
23+ override fun run () {
24+
25+ val current = kit.getVirtualFile() ? : return
26+ if (! current.isDirectory) {
27+ return
28+ }
29+ AucTemplate .APP .forEach {
30+ if (it.isDir) {
31+ kit.createDir(it.getPath())
32+ } else {
33+ kit.createFile(it.getPath())
34+ }
35+ }
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments