├── .idea ├── .gitignore ├── vcs.xml ├── kotlinc.xml ├── misc.xml └── gradle.xml ├── .gitattributes ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── src └── main │ ├── resources │ ├── image │ │ ├── icon.jpg │ │ └── getx_icon.png │ ├── templates │ │ ├── normal │ │ │ ├── state.dart │ │ │ ├── easy │ │ │ │ ├── logic.dart │ │ │ │ └── view.dart │ │ │ ├── logic.dart │ │ │ ├── binding_4.dart │ │ │ ├── binding_5.dart │ │ │ └── view.dart │ │ ├── lifecycle │ │ │ ├── easy │ │ │ │ └── logic.dart │ │ │ └── logic.dart │ │ ├── pageView │ │ │ ├── easy │ │ │ │ └── view.dart │ │ │ └── view.dart │ │ └── auto │ │ │ ├── easy │ │ │ └── view.dart │ │ │ └── view.dart │ ├── intentionDescriptions │ │ ├── WrapWithGetXAction │ │ │ ├── description.html │ │ │ ├── before.java.template │ │ │ └── after.java.template │ │ ├── WrapWithObxAction │ │ │ ├── description.html │ │ │ ├── before.java.template │ │ │ └── after.java.template │ │ ├── WrapWithGetBuilderAction │ │ │ ├── description.html │ │ │ ├── before.java.template │ │ │ └── after.java.template │ │ └── WrapWithGetBuilderAutoDisposeAction │ │ │ ├── description.html │ │ │ ├── before.java.template │ │ │ └── after.java.template │ ├── META-INF │ │ ├── pluginIcon.svg │ │ └── plugin.xml │ └── liveTemplates │ │ └── getX.xml │ └── kotlin │ ├── intention_action │ ├── SnippetType.kt │ ├── WrapWithGetAction.kt │ ├── WrapHelper.kt │ ├── Snippets.kt │ └── WrapWithAction.kt │ ├── live_templates │ └── GetXContext.kt │ ├── helper │ ├── GetXName.kt │ ├── DataService.kt │ └── GetXConfig.kt │ ├── setting │ ├── SettingsConfigurable.kt │ └── SettingsComponent.kt │ └── action │ ├── NewGetXView.kt │ └── NewGetXAction.kt ├── settings.gradle.kts ├── gradle.properties ├── pluginDescription.md ├── .gitignore ├── .run └── Run IDE with Plugin.run.xml ├── changeNotes.md ├── gradlew.bat ├── README.md ├── gradlew └── LICENSE /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdd666t/getx_template/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/image/icon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdd666t/getx_template/HEAD/src/main/resources/image/icon.jpg -------------------------------------------------------------------------------- /src/main/resources/image/getx_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xdd666t/getx_template/HEAD/src/main/resources/image/getx_icon.png -------------------------------------------------------------------------------- /src/main/resources/templates/normal/state.dart: -------------------------------------------------------------------------------- 1 | class @nameState { 2 | @nameState() { 3 | ///Initialize variables 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/WrapWithGetXAction/description.html: -------------------------------------------------------------------------------- 1 | 2 | Wraps the current widget in a GetX 3 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/WrapWithObxAction/description.html: -------------------------------------------------------------------------------- 1 | 2 | Wraps the current widget in a Obx 3 | -------------------------------------------------------------------------------- /src/main/resources/templates/normal/easy/logic.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | 3 | class @nameLogic extends GetxController { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/WrapWithGetBuilderAction/description.html: -------------------------------------------------------------------------------- 1 | 2 | Wraps the current widget in a GetBuilder 3 | -------------------------------------------------------------------------------- /src/main/kotlin/intention_action/SnippetType.kt: -------------------------------------------------------------------------------- 1 | package intention_action 2 | 3 | enum class SnippetType { 4 | Obx, GetBuilder, Observer, GetBuilderAutoDispose, GetX, 5 | } -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | mavenCentral() 4 | gradlePluginPortal() 5 | } 6 | } 7 | 8 | rootProject.name = "getx_template" -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/WrapWithGetBuilderAutoDisposeAction/description.html: -------------------------------------------------------------------------------- 1 | 2 | Wraps the current widget in a GetBuilder (Auto Dispose GetXController) 3 | -------------------------------------------------------------------------------- /.idea/kotlinc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /src/main/resources/templates/normal/logic.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | 3 | import 'state.dart'; 4 | 5 | class @nameLogic extends GetxController { 6 | final @nameState state = @nameState(); 7 | } 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/WrapWithGetXAction/before.java.template: -------------------------------------------------------------------------------- 1 | class Counter extends StatelessWidget { 2 | @override 3 | Widget build(BuildContext context) { 4 | return Scaffold( 5 | body: Text('Counter'), 6 | ); 7 | } 8 | } -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/WrapWithObxAction/before.java.template: -------------------------------------------------------------------------------- 1 | class Counter extends StatelessWidget { 2 | @override 3 | Widget build(BuildContext context) { 4 | return Scaffold( 5 | body: Text('Counter'), 6 | ); 7 | } 8 | } -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/WrapWithGetBuilderAction/before.java.template: -------------------------------------------------------------------------------- 1 | class Counter extends StatelessWidget { 2 | @override 3 | Widget build(BuildContext context) { 4 | return Scaffold( 5 | body: Text('Counter'), 6 | ); 7 | } 8 | } -------------------------------------------------------------------------------- /src/main/resources/templates/normal/binding_4.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | 3 | import 'logic.dart'; 4 | 5 | class @nameBinding extends Bindings { 6 | @override 7 | void dependencies() { 8 | Get.lazyPut(() => @nameLogic()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/WrapWithGetBuilderAutoDisposeAction/before.java.template: -------------------------------------------------------------------------------- 1 | class Counter extends StatelessWidget { 2 | @override 3 | Widget build(BuildContext context) { 4 | return Scaffold( 5 | body: Text('Counter'), 6 | ); 7 | } 8 | } -------------------------------------------------------------------------------- /src/main/resources/templates/normal/binding_5.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | 3 | import 'logic.dart'; 4 | 5 | class @nameBinding extends Binding { 6 | @override 7 | List dependencies() { 8 | return [Bind.lazyPut(() => @nameLogic())]; 9 | } 10 | } -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/WrapWithObxAction/after.java.template: -------------------------------------------------------------------------------- 1 | class Counter extends StatelessWidget { 2 | @override 3 | Widget build(BuildContext context) { 4 | return Scaffold( 5 | body: Obx(() { 6 | return Text('Counter'); 7 | }), 8 | ); 9 | } 10 | } -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/WrapWithGetBuilderAction/after.java.template: -------------------------------------------------------------------------------- 1 | class Counter extends StatelessWidget { 2 | @override 3 | Widget build(BuildContext context) { 4 | return Scaffold( 5 | body: GetBuilder(builder: (controller) { 6 | return Text('Counter'); 7 | }), 8 | ); 9 | } 10 | } -------------------------------------------------------------------------------- /src/main/resources/templates/lifecycle/easy/logic.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | 3 | class @nameLogic extends GetxController { 4 | @override 5 | void onReady() { 6 | // TODO: implement onReady 7 | super.onReady(); 8 | } 9 | 10 | @override 11 | void onClose() { 12 | // TODO: implement onClose 13 | super.onClose(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/main/kotlin/live_templates/GetXContext.kt: -------------------------------------------------------------------------------- 1 | package live_templates 2 | 3 | import com.intellij.codeInsight.template.TemplateContextType 4 | import com.intellij.psi.PsiFile 5 | 6 | class GetXContext : TemplateContextType("FLUTTER", "Flutter") { 7 | override fun isInContext(file: PsiFile, offset: Int): Boolean { 8 | return file.name.endsWith(".dart") 9 | } 10 | } -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/WrapWithGetBuilderAutoDisposeAction/after.java.template: -------------------------------------------------------------------------------- 1 | class Counter extends StatelessWidget { 2 | @override 3 | Widget build(BuildContext context) { 4 | return Scaffold( 5 | body: GetBuilder( 6 | assignId: true, 7 | builder: (controller) { 8 | return Text('Counter'); 9 | } 10 | ), 11 | ); 12 | } 13 | } -------------------------------------------------------------------------------- /src/main/resources/templates/normal/easy/view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:get/get.dart'; 3 | 4 | import 'logic.dart'; 5 | 6 | class @namePage extends StatelessWidget { 7 | @namePage({Key? key}) : super(key: key); 8 | 9 | final @nameLogic logic = Get.put(@nameLogic()); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Container(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/resources/templates/pageView/easy/view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:get/get.dart'; 3 | 4 | import 'logic.dart'; 5 | 6 | class @namePage extends StatelessWidget { 7 | const @namePage({Key? key}) : super(key: key); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | final @nameLogic logic = Get.put(@nameLogic()); 12 | 13 | return Container(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib 2 | kotlin.stdlib.default.dependency = false 3 | 4 | # Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html 5 | org.gradle.configuration-cache = true 6 | 7 | # Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html 8 | org.gradle.caching = true 9 | -------------------------------------------------------------------------------- /src/main/resources/intentionDescriptions/WrapWithGetXAction/after.java.template: -------------------------------------------------------------------------------- 1 | class Counter extends StatelessWidget { 2 | @override 3 | Widget build(BuildContext context) { 4 | return Scaffold( 5 | body: GetX( 6 | init: SubjectController(), 7 | initState: (_) {}, 8 | builder: (controller) { 9 | return Text('Counter'); 10 | }, 11 | ), 12 | ); 13 | } 14 | } -------------------------------------------------------------------------------- /src/main/resources/templates/lifecycle/logic.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | 3 | import 'state.dart'; 4 | 5 | class @nameLogic extends GetxController { 6 | final @nameState state = @nameState(); 7 | 8 | @override 9 | void onReady() { 10 | // TODO: implement onReady 11 | super.onReady(); 12 | } 13 | 14 | @override 15 | void onClose() { 16 | // TODO: implement onClose 17 | super.onClose(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/templates/normal/view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:get/get.dart'; 3 | 4 | import 'logic.dart'; 5 | import 'state.dart'; 6 | 7 | class @namePage extends StatelessWidget { 8 | @namePage({Key? key}) : super(key: key); 9 | 10 | final @nameLogic logic = Get.put(@nameLogic()); 11 | final @nameState state = Get.find<@nameLogic>().state; 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Container(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/resources/templates/pageView/view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:get/get.dart'; 3 | 4 | import 'logic.dart'; 5 | import 'state.dart'; 6 | 7 | class @namePage extends StatelessWidget { 8 | const @namePage({Key? key}) : super(key: key); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | final @nameLogic logic = Get.put(@nameLogic()); 13 | final @nameState state = Get.find<@nameLogic>().state; 14 | 15 | return Container(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/resources/templates/auto/easy/view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:get/get.dart'; 3 | 4 | import 'logic.dart'; 5 | 6 | class @namePage extends StatefulWidget { 7 | const @namePage({Key? key}) : super(key: key); 8 | 9 | @override 10 | State<@namePage> createState() => _@namePageState(); 11 | } 12 | 13 | class _@namePageState extends State<@namePage> { 14 | final @nameLogic logic = Get.put(@nameLogic()); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return Container(); 19 | } 20 | 21 | @override 22 | void dispose() { 23 | Get.delete<@nameLogic>(); 24 | super.dispose(); 25 | } 26 | } -------------------------------------------------------------------------------- /pluginDescription.md: -------------------------------------------------------------------------------- 1 | # getx_template 2 | 3 | **Used to generate the template code of GetX framework** 4 | 5 | - Right-click the File: New -> GetX 6 | - GitHub:[getx_template](https://github.com/CNAD666/getx_template) 7 | 8 | ### GetX Use Article 9 | 10 | - 使用:[Flutter GetX使用---简洁的魅力!](https://juejin.cn/post/6924104248275763208) 11 | - 原理: [Flutter GetX深度剖析 | 我们终将走出自己的路](https://juejin.cn/post/6984593635681517582) 12 | - 插件说明: [本IDEA插件超详细使用教程](https://juejin.cn/post/7005003323753365517) 13 | 14 | ### Statement 15 | - Part of fast code snippet prompt come 16 | from [getx-snippets-intelliJ](https://github.com/cjamcu/getx-snippets-intelliJ/blob/master/src/main/resources/liveTemplates/getx.xml) 17 | 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build/ 3 | !gradle/wrapper/gradle-wrapper.jar 4 | !**/src/main/**/build/ 5 | !**/src/test/**/build/ 6 | 7 | ### IntelliJ IDEA ### 8 | .idea/modules.xml 9 | .idea/jarRepositories.xml 10 | .idea/compiler.xml 11 | .idea/libraries/ 12 | *.iws 13 | *.iml 14 | *.ipr 15 | out/ 16 | !**/src/main/**/out/ 17 | !**/src/test/**/out/ 18 | 19 | ### Eclipse ### 20 | .apt_generated 21 | .classpath 22 | .factorypath 23 | .project 24 | .settings 25 | .springBeans 26 | .sts4-cache 27 | bin/ 28 | !**/src/main/**/bin/ 29 | !**/src/test/**/bin/ 30 | 31 | ### NetBeans ### 32 | /nbproject/private/ 33 | /nbbuild/ 34 | /dist/ 35 | /nbdist/ 36 | /.nb-gradle/ 37 | 38 | ### VS Code ### 39 | .vscode/ 40 | 41 | ### Mac OS ### 42 | .DS_Store -------------------------------------------------------------------------------- /src/main/resources/templates/auto/view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:get/get.dart'; 3 | 4 | import 'logic.dart'; 5 | import 'state.dart'; 6 | 7 | class @namePage extends StatefulWidget { 8 | const @namePage({Key? key}) : super(key: key); 9 | 10 | @override 11 | State<@namePage> createState() => _@namePageState(); 12 | } 13 | 14 | class _@namePageState extends State<@namePage> { 15 | final @nameLogic logic = Get.put(@nameLogic()); 16 | final @nameState state = Get.find<@nameLogic>().state; 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return Container(); 21 | } 22 | 23 | @override 24 | void dispose() { 25 | Get.delete<@nameLogic>(); 26 | super.dispose(); 27 | } 28 | } -------------------------------------------------------------------------------- /src/main/kotlin/helper/GetXName.kt: -------------------------------------------------------------------------------- 1 | package helper 2 | 3 | object GetXName { 4 | // mode 5 | const val ModeDefault = "Default" 6 | const val ModeEasy = "Easy" 7 | 8 | //main function 9 | const val mainUseGetX5 = "useGetX5" 10 | const val mainUseFolder = "useFolder" 11 | const val mainUsePrefix = "usePrefix" 12 | const val mainIsPageView = "isPageView" 13 | const val mainAddBinding = "addBinding" 14 | 15 | //minor function 16 | const val minorAddLifecycle = "addLifecycle" 17 | const val minorAutoDispose = "autoDispose" 18 | const val minorLintNorm = "lintNorm" 19 | 20 | //template function 21 | const val templatePage = "Page" 22 | const val templateComponent = "Component" 23 | const val templateCustom = "Custom" 24 | } -------------------------------------------------------------------------------- /src/main/kotlin/intention_action/WrapWithGetAction.kt: -------------------------------------------------------------------------------- 1 | package intention_action 2 | 3 | class WrapWithGetBuilderAction : WrapWithAction(SnippetType.GetBuilder) { 4 | override fun getText(): String { 5 | return "Wrap with GetBuilder" 6 | } 7 | } 8 | 9 | class WrapWithGetBuilderAutoDisposeAction : WrapWithAction(SnippetType.GetBuilderAutoDispose) { 10 | override fun getText(): String { 11 | return "Wrap with GetBuilder (Auto Dispose)" 12 | } 13 | } 14 | 15 | class WrapWithGetXAction : WrapWithAction(SnippetType.GetX) { 16 | override fun getText(): String { 17 | return "Wrap with GetX" 18 | } 19 | } 20 | 21 | class WrapWithObxAction : WrapWithAction(SnippetType.Obx) { 22 | override fun getText(): String { 23 | return "Wrap with Obx" 24 | } 25 | } 26 | 27 | class WrapWithObserverAction : WrapWithAction(SnippetType.Observer) { 28 | override fun getText(): String { 29 | return "Wrap with Observer" 30 | } 31 | } -------------------------------------------------------------------------------- /src/main/kotlin/intention_action/WrapHelper.kt: -------------------------------------------------------------------------------- 1 | package intention_action; 2 | 3 | import com.intellij.psi.PsiElement 4 | 5 | object WrapHelper { 6 | @JvmStatic 7 | fun callExpressionFinder(psiElement: PsiElement): PsiElement? { 8 | var psiElementFinder: PsiElement? = psiElement.parent 9 | 10 | for (i in 1..10) { 11 | if (psiElementFinder == null) { 12 | return null 13 | } 14 | 15 | val str = psiElementFinder.toString() 16 | if (str == "CALL_EXPRESSION" || str == "ARGUMENTS") { 17 | if (psiElementFinder.text.startsWith(psiElement.text)) { 18 | return psiElementFinder 19 | } 20 | return null 21 | } 22 | psiElementFinder = psiElementFinder.parent 23 | } 24 | return null 25 | } 26 | 27 | @JvmStatic 28 | fun isSelectionValid(start: Int, end: Int): Boolean { 29 | if (start <= -1 || end <= -1) { 30 | return false 31 | } 32 | 33 | if (start >= end) { 34 | return false 35 | } 36 | 37 | return true 38 | } 39 | } -------------------------------------------------------------------------------- /.run/Run IDE with Plugin.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 12 | 17 | 19 | true 20 | true 21 | false 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/pluginIcon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /changeNotes.md: -------------------------------------------------------------------------------- 1 | # 3.5.x 2 | - Compatible with getX5 3 | - Add "Observer" wrap 4 | - Optimize binding content 5 | - Optimize lint 6 | 7 | # 3.3.x 8 | - Adjust StatefulWidget template 9 | - Optimize wrap feature 10 | - LintNorm: the default value is changed to true 11 | - Fix some bug 12 | 13 | # 3.2.x 14 | - Add template switch function 15 | - Refactor setting layout 16 | - Support flutter_lints 17 | - Separate lintNorm:lint and flutter_lints 18 | - Fix template title is missing 19 | - Add useFolderSuffix function in the setting 20 | 21 | # 3.1.x 22 | - Significantly optimize the layout 23 | - Support lint norm 24 | - Optimize the prompt function:“get" ---prefix adjustment---> "getx" 25 | - Add an article about how to use the plugin 26 | 27 | # 3.0.x 28 | - migrate kotlin 29 | - capitalize the first letter of the module name 30 | - add some snippets code 31 | - view and logic separate 32 | - GetBuilder adds automatic dispose Wrap Widget 33 | - Add PageView solution 34 | - Fix bug 35 | 36 | # 2.1.x 37 | - Major update!!! 38 | - add wrap snippet:Obx,GetBuilder,GetX 39 | - add fast snippet prompt 40 | - fast snippet come from getx-snippets-intelliJ 41 | - optimized layout 42 | - add prefect lifecycle function 43 | - add binding 44 | 45 | # 1.5.x 46 | - add memory function 47 | - support to modify Logic name 48 | - add GetxController auto dispose 49 | - support to modify View,State name 50 | - adjust some message 51 | - fix bug 52 | 53 | # 1.3.x 54 | - compatible with multiple versions of ideas 55 | - comment adjustment 56 | - add getx english use article 57 | - improve description 58 | - add plugin logo 59 | 60 | # 1.2 61 | - improve description content 62 | 63 | # 1.1 64 | - Fix the problem of selecting prefix and reporting errors in import packages 65 | 66 | # 1.0 67 | - You can generate a large number of GetX template codes 68 | - Improve development efficiency 69 | - If you have any questions, please give feedback -------------------------------------------------------------------------------- /src/main/kotlin/intention_action/Snippets.kt: -------------------------------------------------------------------------------- 1 | package intention_action 2 | 3 | import helper.DataService.Companion.instance 4 | import java.util.* 5 | 6 | object Snippets { 7 | private val data = instance 8 | const val PREFIX_SELECTION = "Subject" 9 | private val SUFFIX1 = data.module.logicName 10 | val GetX_SNIPPET_KEY = PREFIX_SELECTION + SUFFIX1 11 | 12 | fun getSnippet(snippetType: SnippetType?, widget: String): String { 13 | return when (snippetType) { 14 | SnippetType.Obx -> snippetObx(widget) 15 | SnippetType.GetBuilder -> snippetGetBuilder(widget) 16 | SnippetType.Observer -> snippetObserver(widget) 17 | SnippetType.GetBuilderAutoDispose -> snippetGetBuilderAutoDispose(widget) 18 | SnippetType.GetX -> snippetGetX(widget) 19 | else -> "" 20 | } 21 | } 22 | 23 | private fun snippetObx(widget: String): String { 24 | return String.format( 25 | """Obx(() { 26 | return %1${"$"}s; 27 | })""", widget 28 | ) 29 | } 30 | 31 | private fun snippetGetBuilder(widget: String): String { 32 | return String.format( 33 | """GetBuilder<%1${"$"}s>(builder: (%2${"$"}s) { 34 | return %3${"$"}s; 35 | })""", GetX_SNIPPET_KEY, data.module.logicName.lowercase(Locale.getDefault()), widget 36 | ) 37 | } 38 | 39 | private fun snippetObserver(widget: String): String { 40 | return String.format( 41 | """Observer(builder: (BuildContext context) { 42 | return %1${"$"}s; 43 | })""", widget 44 | ) 45 | } 46 | 47 | private fun snippetGetBuilderAutoDispose(widget: String): String { 48 | return String.format( 49 | """GetBuilder<%1${"$"}s>( 50 | assignId: true, 51 | builder: (%2${"$"}s) { 52 | return %3${"$"}s; 53 | }, 54 | )""", GetX_SNIPPET_KEY, data.module.logicName.lowercase(Locale.getDefault()), widget 55 | ) 56 | } 57 | 58 | private fun snippetGetX(widget: String): String { 59 | return String.format( 60 | """GetX<%1${"$"}s>( 61 | init: %1${"$"}s(), 62 | initState: (_) {}, 63 | builder: (%2${"$"}s) { 64 | return %3${"$"}s; 65 | }, 66 | )""", GetX_SNIPPET_KEY, data.module.logicName.lowercase(Locale.getDefault()), widget 67 | ) 68 | } 69 | } -------------------------------------------------------------------------------- /src/main/kotlin/helper/DataService.kt: -------------------------------------------------------------------------------- 1 | package helper 2 | 3 | import com.intellij.openapi.components.PersistentStateComponent 4 | import com.intellij.openapi.components.ServiceManager 5 | import com.intellij.openapi.components.State 6 | import com.intellij.openapi.components.Storage 7 | import com.intellij.util.xmlb.XmlSerializerUtil 8 | import com.intellij.util.xmlb.annotations.OptionTag 9 | 10 | //val modeInfoConverter: KClass> = ModeInfoConverter::class; 11 | 12 | //custom save location 13 | @State(name = "DataService", storages = [Storage(value = "DataService.xml")]) 14 | class DataService : PersistentStateComponent { 15 | //default true: use default mode 16 | @JvmField 17 | var modeDefault = true 18 | 19 | //default false:default not use easy mode 20 | @JvmField 21 | var modeEasy = false 22 | 23 | //module name suffix 24 | @JvmField 25 | @OptionTag(converter = ModuleNameSuffixConverter::class) 26 | var module = ModuleNameSuffix( 27 | viewName = "Page", viewFileName = "View", logicName = "Logic", 28 | stateName = "State", 29 | ) 30 | 31 | //select function 32 | @JvmField 33 | @OptionTag(converter = FunctionInfoConverter::class) 34 | var function = FunctionInfo( 35 | useGetX5 = true, useFolder = true, usePrefix = false, isPageView = false, 36 | addBinding = false, addLifecycle = false, autoDispose = false, funTabIndex = 0, 37 | ) 38 | 39 | //setting info 40 | @JvmField 41 | @OptionTag(converter = SettingInfoConverter::class) 42 | var setting = SettingInfo(useFolderSuffix = false) 43 | 44 | ///default true 45 | @JvmField 46 | @OptionTag(converter = TemplateInfoConverter::class) 47 | var templatePage = TemplateInfo(view = "Page", selected = true) 48 | 49 | ///default false 50 | @JvmField 51 | @OptionTag(converter = TemplateInfoConverter::class) 52 | var templateComponent = TemplateInfo(view = "Component", selected = false) 53 | 54 | ///default false 55 | @JvmField 56 | @OptionTag(converter = TemplateInfoConverter::class) 57 | var templateCustom = TemplateInfo(view = "Widget", selected = false) 58 | 59 | 60 | override fun getState(): DataService { 61 | return this 62 | } 63 | 64 | override fun loadState(state: DataService) { 65 | XmlSerializerUtil.copyBean(state, this) 66 | } 67 | 68 | companion object { 69 | @JvmStatic 70 | val instance: DataService 71 | get() = ServiceManager.getService(DataService::class.java) 72 | } 73 | } -------------------------------------------------------------------------------- /src/main/kotlin/helper/GetXConfig.kt: -------------------------------------------------------------------------------- 1 | package helper 2 | 3 | import com.google.gson.Gson 4 | import com.intellij.util.xmlb.Converter 5 | 6 | data class TemplateInfo( 7 | var logic: String = "Logic", 8 | var view: String = "Page", 9 | var viewFile: String = "View", 10 | var state: String = "State", 11 | var selected: Boolean = false, 12 | ) 13 | 14 | ///select function 15 | data class FunctionInfo( 16 | //default true 17 | var useGetX5: Boolean = false, 18 | //default true 19 | var useFolder: Boolean = true, 20 | //default false 21 | var usePrefix: Boolean = false, 22 | //default false 23 | var isPageView: Boolean = false, 24 | //auto dispose GetXController 25 | var autoDispose: Boolean = false, 26 | //add Lifecycle 27 | var addLifecycle: Boolean = false, 28 | //add binding 29 | var addBinding: Boolean = false, 30 | //function tab index 31 | var funTabIndex: Int = 0, 32 | ) 33 | 34 | //module name 35 | data class ModuleNameSuffix( 36 | //Logical layer name 37 | var logicName: String = "Logic", 38 | //view layer name 39 | var viewName: String = "Page", 40 | var viewFileName: String = "View", 41 | //state layer name 42 | var stateName: String = "State", 43 | ) 44 | 45 | //Setting Info 46 | data class SettingInfo( 47 | //open folder suffix 48 | var useFolderSuffix: Boolean = false, 49 | ) 50 | 51 | class ModuleNameSuffixConverter : Converter() { 52 | override fun toString(value: ModuleNameSuffix): String? { 53 | return Gson().toJson(value) 54 | } 55 | 56 | override fun fromString(value: String): ModuleNameSuffix? { 57 | return Gson().fromJson(value, ModuleNameSuffix::class.java) 58 | } 59 | } 60 | 61 | class FunctionInfoConverter : Converter() { 62 | override fun toString(value: FunctionInfo): String? { 63 | return Gson().toJson(value) 64 | } 65 | 66 | override fun fromString(value: String): FunctionInfo? { 67 | return Gson().fromJson(value, FunctionInfo::class.java) 68 | } 69 | } 70 | 71 | class SettingInfoConverter : Converter() { 72 | override fun toString(value: SettingInfo): String? { 73 | return Gson().toJson(value) 74 | } 75 | 76 | override fun fromString(value: String): SettingInfo? { 77 | return Gson().fromJson(value, SettingInfo::class.java) 78 | } 79 | } 80 | 81 | class TemplateInfoConverter : Converter() { 82 | override fun toString(value: TemplateInfo): String? { 83 | return Gson().toJson(value) 84 | } 85 | 86 | override fun fromString(value: String): TemplateInfo? { 87 | return Gson().fromJson(value, TemplateInfo::class.java) 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/main/resources/META-INF/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | GetX 4 | 5 | 6 | 7 | 小呆呆666 8 | 9 | 11 | com.intellij.modules.all 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | intention_action.WrapWithObxAction 41 | GetX 42 | 43 | 44 | 45 | intention_action.WrapWithGetBuilderAction 46 | GetX 47 | 48 | 49 | 50 | intention_action.WrapWithObserverAction 51 | GetX 52 | 53 | 54 | 55 | intention_action.WrapWithGetBuilderAutoDisposeAction 56 | GetX 57 | 58 | 59 | 60 | intention_action.WrapWithGetXAction 61 | GetX 62 | 63 | 64 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /src/main/kotlin/setting/SettingsConfigurable.kt: -------------------------------------------------------------------------------- 1 | package setting 2 | 3 | import com.intellij.openapi.options.Configurable 4 | import helper.DataService 5 | import org.jetbrains.annotations.Nls 6 | import javax.swing.JComponent 7 | 8 | class SettingsConfigurable : Configurable { 9 | private val data = DataService.instance 10 | private var mSetting: SettingsComponent? = null 11 | 12 | @Nls(capitalization = Nls.Capitalization.Title) 13 | override fun getDisplayName(): String { 14 | return "GetX Setting" 15 | } 16 | 17 | override fun createComponent(): JComponent { 18 | mSetting = SettingsComponent() 19 | return mSetting!!.mainPanel 20 | } 21 | 22 | override fun isModified(): Boolean { 23 | return (//Page 24 | mSetting!!.page.logic.text != data.templatePage.logic 25 | || mSetting!!.page.state.text != data.templatePage.state 26 | || mSetting!!.page.view.text != data.templatePage.view 27 | || mSetting!!.page.viewFile.text != data.templatePage.viewFile 28 | //Component 29 | || mSetting!!.component.logic.text != data.templateComponent.logic 30 | || mSetting!!.component.state.text != data.templateComponent.state 31 | || mSetting!!.component.view.text != data.templateComponent.view 32 | || mSetting!!.component.viewFile.text != data.templateComponent.viewFile 33 | //Custom 34 | || mSetting!!.custom.logic.text != data.templateCustom.logic 35 | || mSetting!!.custom.state.text != data.templateCustom.state 36 | || mSetting!!.custom.view.text != data.templateCustom.view 37 | || mSetting!!.custom.viewFile.text != data.templateCustom.viewFile 38 | ) 39 | } 40 | 41 | override fun apply() { 42 | //Page 43 | data.templatePage.logic = mSetting!!.page.logic.text 44 | data.templatePage.state = mSetting!!.page.state.text 45 | data.templatePage.view = mSetting!!.page.view.text 46 | data.templatePage.viewFile = mSetting!!.page.viewFile.text 47 | //Component 48 | data.templateComponent.logic = mSetting!!.component.logic.text 49 | data.templateComponent.state = mSetting!!.component.state.text 50 | data.templateComponent.view = mSetting!!.component.view.text 51 | data.templateComponent.viewFile = mSetting!!.component.viewFile.text 52 | //Custom 53 | data.templateCustom.logic = mSetting!!.custom.logic.text 54 | data.templateCustom.state = mSetting!!.custom.state.text 55 | data.templateCustom.view = mSetting!!.custom.view.text 56 | data.templateCustom.viewFile = mSetting!!.custom.viewFile.text 57 | } 58 | 59 | override fun reset() { 60 | //page 61 | mSetting!!.page.logic.text = data.templatePage.logic 62 | mSetting!!.page.state.text = data.templatePage.state 63 | mSetting!!.page.view.text = data.templatePage.view 64 | mSetting!!.page.viewFile.text = data.templatePage.viewFile 65 | //component 66 | mSetting!!.component.logic.text = data.templateComponent.logic 67 | mSetting!!.component.state.text = data.templateComponent.state 68 | mSetting!!.component.view.text = data.templateComponent.view 69 | mSetting!!.component.viewFile.text = data.templateComponent.viewFile 70 | //custom 71 | mSetting!!.custom.logic.text = data.templateCustom.logic 72 | mSetting!!.custom.state.text = data.templateCustom.state 73 | mSetting!!.custom.view.text = data.templateCustom.view 74 | mSetting!!.custom.viewFile.text = data.templateCustom.viewFile 75 | } 76 | 77 | override fun disposeUIResources() { 78 | mSetting = null 79 | } 80 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![plugin](https://img.shields.io/badge/jetbrain-plugin-red)](https://plugins.jetbrains.com/plugin/15919-getx) [![stars](https://img.shields.io/github/stars/xdd666t/getx_template?logo=github)](https://github.com/CNAD666/getx_template) [![issues](https://img.shields.io/github/issues/xdd666t/getx_template?logo=github)](https://github.com/xdd666t/getx_template/issues) [![commit](https://img.shields.io/github/last-commit/xdd666t/getx_template?logo=github)](https://github.com/xdd666t/getx_template/commits) [![release](https://img.shields.io/github/v/release/xdd666t/getx_template)](https://github.com/xdd666t/getx_template/releases) 2 | 3 | Language: English | [中文(详细讲解)](https://juejin.cn/post/7005003323753365517) 4 | # Statement 5 | 6 | - Part of fast code snippet prompt come from [getx-snippets-intelliJ](https://github.com/cjamcu/getx-snippets-intelliJ/blob/master/src/main/resources/liveTemplates/getx.xml) 7 | 8 | # Description 9 | 10 | - install 11 | 12 | ![install](https://cdn.jsdelivr.net/gh/xdd666t/MyData@master/pic/flutter/blog/20220206120123.png) 13 | 14 | - Plugin effect 15 | 16 | - Take a look at the effect diagram used by the plugin. The style refers to the fish_redux plugin style. 17 | - There are some optional functions, so make it into a multi-button style, you can operate according to your own needs 18 | 19 | ![useFolder](https://cdn.jsdelivr.net/gh/xdd666t/MyData@master/pic/flutter/blog/20210907092614.gif) 20 | 21 | - Support to modify suffix 22 | 23 | ![image-20210926111944785](https://cdn.jsdelivr.net/gh/CNAD666/MyData@master/pic/flutter/blog/20210926112248.png) 24 | 25 | - Alt + Enter : GetBuilder、GetBuilder(Auto Dispose)、Obx、GetX 26 | 27 | ![GetBuilder](https://cdn.jsdelivr.net/gh/xdd666t/MyData@master/pic/flutter/blog/20210907092748.gif) 28 | 29 | ![image-20210802160603092](https://cdn.jsdelivr.net/gh/CNAD666/MyData@master/pic/flutter/blog/20210802162033.png) 30 | 31 | ![image-20210802160631405](https://cdn.jsdelivr.net/gh/CNAD666/MyData@master/pic/flutter/blog/20210802162043.png) 32 | 33 | - Enter the **getx** prefix 34 | 35 | ![getxroutepagemap](https://cdn.jsdelivr.net/gh/xdd666t/MyData@master/pic/flutter/blog/20210907092900.gif) 36 | 37 | ![image-20210922111700625](https://cdn.jsdelivr.net/gh/CNAD666/MyData@master/pic/flutter/blog/20210922111709.png) 38 | 39 | # Features 40 | 41 | - Model: Generate the GetX model 42 | - Default: Default mode, three files are generated: state, logic, view 43 | - Easy: Simple mode, two files are generated: logic, view 44 | 45 | - Function: Function selection 46 | - useFolder: Use a file, a folder will be generated after selection, and the big hump name will be automatically converted to: lowercase + underscore 47 | 48 | - usePrefix: Use the prefix, add the prefix before the generated file, the prefix is: Big Camel Name is automatically converted to: lowercase + underscore 49 | 50 | - autoDispose: If you find that a page cannot automatically recycle GetxController, you can turn on this function, refer to How to automatically recycle GetXController; under normal circumstances, there is no need to turn on this function 51 | 52 | - addLifecycle: Automatically add the life cycle callback method in GetXController, and enable it on demand 53 | 54 | - addBinding: automatically add binding files 55 | - If you know what binding is, it is recommended to enable this function 56 | - If you don't understand the concept and function of binding, it is not recommended to turn it on; not using binding will not affect development 57 | 58 | - Module Name: The name of the module, please use the big camel case as much as possible; capitalize the first letter 59 | 60 | 61 | # Run this project 62 | 63 | **If you want to run this project,please confirm some of your configuration** 64 | 65 | - File ---> Project Structure ---> Project Settings:Project(SDK must use jdk11) 66 | 67 | ![image-20211208095732612](https://cdn.jsdelivr.net/gh/xdd666t/MyData@master/pic/flutter/blog/20211208100315.png) 68 | 69 | - Build, Execution, Deployment ---> Build Tools ---> Gradle 70 | - gradle download: https://services.gradle.org/distributions/ 71 | 72 | ![image-20211208100031275](https://cdn.jsdelivr.net/gh/xdd666t/MyData@master/pic/flutter/blog/20211208100323.png) 73 | -------------------------------------------------------------------------------- /src/main/kotlin/setting/SettingsComponent.kt: -------------------------------------------------------------------------------- 1 | package setting 2 | 3 | import com.intellij.ui.IdeBorderFactory 4 | import com.intellij.ui.components.JBTextField 5 | import com.intellij.ui.layout.selected 6 | import helper.DataService 7 | import net.miginfocom.layout.CC 8 | import net.miginfocom.layout.LC 9 | import net.miginfocom.swing.MigLayout 10 | import java.awt.BorderLayout 11 | import java.awt.Dimension 12 | import java.awt.GridLayout 13 | import javax.swing.* 14 | 15 | 16 | class SettingsComponent { 17 | private val data = DataService.instance 18 | 19 | @JvmField 20 | var mainPanel = JPanel() 21 | 22 | @JvmField 23 | var page = Setting() 24 | 25 | @JvmField 26 | var component = Setting() 27 | 28 | @JvmField 29 | var custom = Setting() 30 | 31 | init { 32 | val functionLayout = selectFunctionLayout() 33 | val pageLayout = templateNameLayout(title = "Page", data = page) 34 | val componentLayout = templateNameLayout(title = "Component", data = component) 35 | val customLayout = templateNameLayout(title = "Custom", data = custom) 36 | 37 | mainPanel.layout = migLayoutVertical() 38 | mainPanel.add(functionLayout, fillX()) 39 | mainPanel.add(pageLayout, fillX()) 40 | mainPanel.add(componentLayout, fillX()) 41 | mainPanel.add(customLayout, fillX()) 42 | mainPanel.add(JPanel(), fillY()) 43 | } 44 | 45 | private fun selectFunctionLayout(): JPanel { 46 | return JPanel().apply { 47 | layout = migLayout() 48 | border = IdeBorderFactory.createTitledBorder("SelectFunction") 49 | 50 | val body = JPanel().apply { 51 | layout = GridLayout(1, 2) 52 | 53 | //open folder suffix 54 | add(useFolderSuffix(), fillX()) 55 | } 56 | add(body, fillX()) 57 | } 58 | } 59 | 60 | private fun useFolderSuffix(): JPanel { 61 | return JPanel().apply { 62 | layout = migLayout() 63 | 64 | add(JLabel().apply { 65 | text = "useFolderSuffix:" 66 | border = BorderFactory.createEmptyBorder() 67 | }) 68 | add(JCheckBox().apply { 69 | border = BorderFactory.createEmptyBorder() 70 | isSelected = data.setting.useFolderSuffix 71 | addActionListener { 72 | data.setting.useFolderSuffix = isSelected 73 | } 74 | }) 75 | 76 | add(JPanel(), fillX()) 77 | } 78 | } 79 | 80 | private fun templateNameLayout(title: String, data: Setting): JPanel { 81 | return JPanel().apply { 82 | layout = migLayout() 83 | border = IdeBorderFactory.createTitledBorder(title) 84 | 85 | val body = JPanel().apply { 86 | layout = GridLayout(2, 2) 87 | 88 | add(templateItem(title = "ViewName", jbTextField = data.view, padding = 20)) 89 | 90 | add(templateItem(title = "LogicName", jbTextField = data.logic, padding = 10)) 91 | 92 | add(templateItem(title = "ViewFileName", jbTextField = data.viewFile, padding = 20)) 93 | 94 | add(templateItem(title = "StateName", jbTextField = data.state, padding = 10)) 95 | } 96 | add(body, fillX()) 97 | } 98 | } 99 | 100 | private fun templateItem(title: String, jbTextField: JBTextField, padding: Int): JPanel { 101 | return JPanel().apply { 102 | layout = migLayout() 103 | border = BorderFactory.createEmptyBorder(0, 0, 15, 80) 104 | 105 | add(JPanel().apply { 106 | layout = BorderLayout() 107 | preferredSize = Dimension(70 + padding, 30) 108 | //left:WEST right:EAST top:NORTH bottom:SOUTH center:CENTER 109 | add(JLabel(title), BorderLayout.WEST) 110 | }) 111 | 112 | add(jbTextField, fillX()) 113 | } 114 | } 115 | } 116 | 117 | class Setting { 118 | var logic = JBTextField() 119 | 120 | var state = JBTextField() 121 | 122 | var view = JBTextField() 123 | 124 | var viewFile = JBTextField() 125 | } 126 | 127 | 128 | fun fillX(): CC = CC().growX().pushX() 129 | fun fillY(): CC = CC().growY().pushY() 130 | fun migLayout() = 131 | MigLayout(LC().fill().gridGap("0!", "0!").insets("0")) 132 | 133 | fun migLayoutVertical() = 134 | MigLayout(LC().flowY().fill().gridGap("0!", "0!").insets("0")) 135 | -------------------------------------------------------------------------------- /src/main/kotlin/intention_action/WrapWithAction.kt: -------------------------------------------------------------------------------- 1 | package intention_action 2 | 3 | import com.intellij.codeInsight.intention.IntentionAction 4 | import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction 5 | import com.intellij.openapi.application.ApplicationManager 6 | import com.intellij.openapi.command.WriteCommandAction 7 | import com.intellij.openapi.editor.Editor 8 | import com.intellij.openapi.project.Project 9 | import com.intellij.openapi.util.TextRange 10 | import com.intellij.psi.PsiDocumentManager 11 | import com.intellij.psi.PsiElement 12 | import com.intellij.psi.PsiFile 13 | import com.intellij.psi.codeStyle.CodeStyleManager 14 | import com.intellij.util.IncorrectOperationException 15 | 16 | abstract class WrapWithAction(private val snippetType: SnippetType) : PsiElementBaseIntentionAction(), IntentionAction { 17 | private var psiElement: PsiElement? = null 18 | 19 | override fun getFamilyName(): String { 20 | return text 21 | } 22 | 23 | override fun isAvailable(project: Project, editor: Editor?, element: PsiElement): Boolean { 24 | if (editor == null) { 25 | return false 26 | } 27 | val currentFile = getCurrentFile(project, editor) 28 | if (currentFile != null && !currentFile.name.endsWith(".dart")) { 29 | return false 30 | } 31 | if (!element.toString().contains("PsiElement")) { 32 | return false 33 | } 34 | psiElement = WrapHelper.callExpressionFinder(element) 35 | return psiElement != null 36 | } 37 | 38 | override fun invoke(project: Project, editor: Editor, element: PsiElement) { 39 | safeUse { 40 | WriteCommandAction.runWriteCommandAction(project) { 41 | safeUse { invokeSnippetAction(project, editor, snippetType) } 42 | } 43 | } 44 | } 45 | 46 | private fun invokeSnippetAction(project: Project, editor: Editor, snippetType: SnippetType?) { 47 | val document = editor.document 48 | val element = psiElement 49 | val elementSelectionRange = element!!.textRange 50 | val offsetStart = elementSelectionRange.startOffset 51 | val offsetEnd = elementSelectionRange.endOffset 52 | if (!WrapHelper.isSelectionValid(offsetStart, offsetEnd)) { 53 | return 54 | } 55 | val selectedText = document.getText(TextRange.create(offsetStart, offsetEnd)) 56 | val replaceWith = Snippets.getSnippet(snippetType, selectedText) 57 | 58 | // wrap the widget: 59 | document.replaceString(offsetStart, offsetEnd, replaceWith) 60 | 61 | // place cursors to specify types: 62 | val prefixSelection = Snippets.PREFIX_SELECTION 63 | val snippetArr = arrayOf(Snippets.GetX_SNIPPET_KEY) 64 | val caretModel = editor.caretModel 65 | caretModel.removeSecondaryCarets() 66 | for (snippet in snippetArr) { 67 | if (!replaceWith.contains(snippet)) { 68 | continue 69 | } 70 | val caretOffset = offsetStart + replaceWith.indexOf(snippet) 71 | val visualPos = editor.offsetToVisualPosition(caretOffset) 72 | caretModel.addCaret(visualPos) 73 | 74 | // select snippet prefix keys: 75 | val currentCaret = caretModel.currentCaret 76 | currentCaret.setSelection(caretOffset, caretOffset + prefixSelection.length) 77 | } 78 | val initialCaret = caretModel.allCarets[0] 79 | if (!initialCaret.hasSelection()) { 80 | // initial position from where was triggered the intention action 81 | caretModel.removeCaret(initialCaret) 82 | } 83 | 84 | // reformat file: 85 | ApplicationManager.getApplication().runWriteAction { 86 | PsiDocumentManager.getInstance(project).commitDocument(document) 87 | val currentFile = getCurrentFile(project, editor) 88 | if (currentFile != null) { 89 | val unFormattedLineCount = document.lineCount 90 | CodeStyleManager.getInstance(project).reformat(currentFile) 91 | val formattedLineCount = document.lineCount 92 | 93 | // file was incorrectly formatted, revert formatting 94 | if (formattedLineCount > unFormattedLineCount + 3) { 95 | document.setText(document.text) 96 | PsiDocumentManager.getInstance(project).commitDocument(document) 97 | } 98 | } 99 | } 100 | } 101 | 102 | override fun startInWriteAction(): Boolean { 103 | return true 104 | } 105 | 106 | private fun getCurrentFile(project: Project, editor: Editor): PsiFile? { 107 | return PsiDocumentManager.getInstance(project).getPsiFile(editor.document) 108 | } 109 | 110 | private fun safeUse(invoke: () -> Unit) { 111 | try { 112 | invoke.invoke() 113 | } catch (_: Exception) { 114 | } 115 | } 116 | } -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 84 | 85 | APP_NAME="Gradle" 86 | APP_BASE_NAME=${0##*/} 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | MAX_FD=$( ulimit -H -n ) || 147 | warn "Could not query maximum file descriptor limit" 148 | esac 149 | case $MAX_FD in #( 150 | '' | soft) :;; #( 151 | *) 152 | ulimit -n "$MAX_FD" || 153 | warn "Could not set maximum file descriptor limit to $MAX_FD" 154 | esac 155 | fi 156 | 157 | # Collect all arguments for the java command, stacking in reverse order: 158 | # * args from the command line 159 | # * the main class name 160 | # * -classpath 161 | # * -D...appname settings 162 | # * --module-path (only if needed) 163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 164 | 165 | # For Cygwin or MSYS, switch paths to Windows format before running java 166 | if "$cygwin" || "$msys" ; then 167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 169 | 170 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 171 | 172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 173 | for arg do 174 | if 175 | case $arg in #( 176 | -*) false ;; # don't mess with options #( 177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 178 | [ -e "$t" ] ;; #( 179 | *) false ;; 180 | esac 181 | then 182 | arg=$( cygpath --path --ignore --mixed "$arg" ) 183 | fi 184 | # Roll the args list around exactly as many times as the number of 185 | # args, so each arg winds up back in the position where it started, but 186 | # possibly modified. 187 | # 188 | # NB: a `for` loop captures its iteration list before it begins, so 189 | # changing the positional parameters here affects neither the number of 190 | # iterations, nor the values presented in `arg`. 191 | shift # remove old arg 192 | set -- "$@" "$arg" # push replacement arg 193 | done 194 | fi 195 | 196 | # Collect all arguments for the java command; 197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 198 | # shell script including quotes and variable substitutions, so put them in 199 | # double quotes to make sure that they get re-expanded; and 200 | # * put everything else in single quotes, so that it's not re-expanded. 201 | 202 | set -- \ 203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 204 | -classpath "$CLASSPATH" \ 205 | org.gradle.wrapper.GradleWrapperMain \ 206 | "$@" 207 | 208 | # Use "xargs" to parse quoted args. 209 | # 210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 211 | # 212 | # In Bash we could simply go: 213 | # 214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 215 | # set -- "${ARGS[@]}" "$@" 216 | # 217 | # but POSIX shell has neither arrays nor command substitution, so instead we 218 | # post-process each arg (as a line of input to sed) to backslash-escape any 219 | # character that might be a shell metacharacter, then use eval to reverse 220 | # that process (while maintaining the separation between arguments), and wrap 221 | # the whole thing up as a single "set" statement. 222 | # 223 | # This will of course break if any of these variables contains a newline or 224 | # an unmatched quote. 225 | # 226 | 227 | eval "set -- $( 228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 229 | xargs -n1 | 230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 231 | tr '\n' ' ' 232 | )" '"$@"' 233 | 234 | exec "$JAVACMD" "$@" 235 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /src/main/kotlin/action/NewGetXView.kt: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import com.intellij.ui.JBColor 4 | import com.intellij.ui.components.JBTabbedPane 5 | import helper.DataService 6 | import helper.GetXName 7 | import java.awt.Container 8 | import java.awt.FlowLayout 9 | import java.awt.GridLayout 10 | import java.awt.event.ActionListener 11 | import java.awt.event.KeyEvent 12 | import java.awt.event.KeyListener 13 | import javax.swing.* 14 | 15 | 16 | open class NewGetXView(private val getXListener: GetXListener) { 17 | private val data = DataService.instance 18 | 19 | /** 20 | * Overall popup entity 21 | */ 22 | private var jDialog: JDialog = JDialog(JFrame(), "GetX Template Code Produce") 23 | lateinit var nameTextField: JTextField 24 | lateinit var modeGroup: ButtonGroup 25 | 26 | /** 27 | * select Function:main Function 28 | */ 29 | lateinit var getX5Box: JCheckBox 30 | lateinit var folderBox: JCheckBox 31 | lateinit var prefixBox: JCheckBox 32 | lateinit var pageViewBox: JCheckBox 33 | 34 | /** 35 | * select Function:minor Function 36 | */ 37 | lateinit var disposeBox: JCheckBox 38 | lateinit var lifecycleBox: JCheckBox 39 | lateinit var bindingBox: JCheckBox 40 | 41 | /** 42 | * select Template:Template Function 43 | */ 44 | lateinit var templateGroup: ButtonGroup 45 | 46 | 47 | private val keyListener: KeyListener = object : KeyListener { 48 | override fun keyTyped(e: KeyEvent) {} 49 | 50 | override fun keyPressed(e: KeyEvent) { 51 | if (e.keyCode == KeyEvent.VK_ENTER) confirm() 52 | if (e.keyCode == KeyEvent.VK_ESCAPE) dispose() 53 | } 54 | 55 | override fun keyReleased(e: KeyEvent) {} 56 | } 57 | 58 | private val actionChangeListener = ActionListener { 59 | //data change 60 | getXListener.onDataChange(this) 61 | 62 | //click btn 63 | if (it.actionCommand == "Cancel") { 64 | dispose() 65 | } else if (it.actionCommand == "OK") { 66 | confirm() 67 | } 68 | } 69 | 70 | init { 71 | //Set function button 72 | val container = jDialog.contentPane 73 | container.layout = BoxLayout(container, BoxLayout.Y_AXIS) 74 | 75 | //Set the main module style: mode, function 76 | //deal default value 77 | setMode(container) 78 | 79 | //deal main function, minor function, template function 80 | val main = getMainFunction() 81 | val minor = getMinorFunction() 82 | val template = getTemplateFunction() 83 | setFunctionTab(main = main, minor = minor, template = template, container = container) 84 | 85 | //Generate module name and ok cancel button 86 | setModuleAndConfirm(container) 87 | 88 | //Choose a pop-up style 89 | setJDialog() 90 | } 91 | 92 | /** 93 | * Main module 94 | */ 95 | private fun setMode(container: Container) { 96 | //Two rows and two columns 97 | val template = JPanel() 98 | template.layout = GridLayout(1, 2) 99 | //Set the main module style:mode, function 100 | template.border = BorderFactory.createTitledBorder("Select Mode") 101 | 102 | //default model 103 | val defaultBtn = JRadioButton(GetXName.ModeDefault, data.modeDefault) 104 | defaultBtn.actionCommand = GetXName.ModeDefault 105 | defaultBtn.addActionListener(actionChangeListener) 106 | defaultBtn.border = BorderFactory.createEmptyBorder(5, 10, 10, 100) 107 | template.add(defaultBtn) 108 | 109 | //easy model 110 | val easyBtn = JRadioButton(GetXName.ModeEasy, data.modeEasy) 111 | easyBtn.actionCommand = GetXName.ModeEasy 112 | easyBtn.addActionListener(actionChangeListener) 113 | easyBtn.border = BorderFactory.createEmptyBorder(5, 10, 10, 100) 114 | template.add(easyBtn) 115 | 116 | modeGroup = ButtonGroup() 117 | modeGroup.add(defaultBtn) 118 | modeGroup.add(easyBtn) 119 | 120 | container.add(template) 121 | setSpacing(container) 122 | } 123 | 124 | /** 125 | * Generate file 126 | */ 127 | private fun getMainFunction(): JPanel { 128 | //Main Function 129 | val main = JPanel() 130 | main.layout = GridLayout(2, 2) 131 | 132 | //use getX5 133 | getX5Box = JCheckBox(GetXName.mainUseGetX5, data.function.useGetX5) 134 | getX5Box.addActionListener(actionChangeListener) 135 | setMargin(getX5Box) 136 | main.add(getX5Box) 137 | 138 | //use folder 139 | folderBox = JCheckBox(GetXName.mainUseFolder, data.function.useFolder) 140 | folderBox.addActionListener(actionChangeListener) 141 | setMargin(folderBox) 142 | main.add(folderBox) 143 | 144 | //use prefix 145 | prefixBox = JCheckBox(GetXName.mainUsePrefix, data.function.usePrefix) 146 | prefixBox.addActionListener(actionChangeListener) 147 | setMargin(prefixBox) 148 | main.add(prefixBox) 149 | 150 | //pageView 151 | pageViewBox = JCheckBox(GetXName.mainIsPageView, data.function.isPageView) 152 | pageViewBox.addActionListener(actionChangeListener) 153 | setBottomMargin(pageViewBox) 154 | main.add(pageViewBox) 155 | 156 | return main 157 | } 158 | 159 | 160 | private fun getMinorFunction(): JPanel { 161 | //Minor Function 162 | val minor = JPanel() 163 | minor.layout = GridLayout(2, 2) 164 | 165 | //add binding 166 | bindingBox = JCheckBox(GetXName.mainAddBinding, data.function.addBinding) 167 | bindingBox.addActionListener(actionChangeListener) 168 | setBottomMargin(bindingBox) 169 | minor.add(bindingBox) 170 | 171 | //add lifecycle 172 | lifecycleBox = JCheckBox(GetXName.minorAddLifecycle, data.function.addLifecycle) 173 | lifecycleBox.addActionListener(actionChangeListener) 174 | setMargin(lifecycleBox) 175 | minor.add(lifecycleBox) 176 | 177 | //auto dispose 178 | disposeBox = JCheckBox(GetXName.minorAutoDispose, data.function.autoDispose) 179 | disposeBox.addActionListener(actionChangeListener) 180 | setMargin(disposeBox) 181 | minor.add(disposeBox) 182 | 183 | return minor 184 | } 185 | 186 | private fun getTemplateFunction(): JPanel { 187 | //Minor Function 188 | val template = JPanel() 189 | template.layout = GridLayout(2, 2) 190 | 191 | //add page 192 | val pageBtn = JRadioButton(GetXName.templatePage, data.templatePage.selected) 193 | pageBtn.actionCommand = GetXName.templatePage 194 | pageBtn.addActionListener(actionChangeListener) 195 | setPadding(pageBtn) 196 | template.add(pageBtn) 197 | 198 | //add component 199 | val componentBtn = JRadioButton(GetXName.templateComponent, data.templateComponent.selected) 200 | componentBtn.actionCommand = GetXName.templateComponent 201 | componentBtn.addActionListener(actionChangeListener) 202 | setPadding(componentBtn) 203 | template.add(componentBtn) 204 | 205 | //add custom 206 | val customBtn = JRadioButton(GetXName.templateCustom, data.templateCustom.selected) 207 | customBtn.actionCommand = GetXName.templateCustom 208 | customBtn.addActionListener(actionChangeListener) 209 | setBottomPadding(customBtn) 210 | template.add(customBtn) 211 | 212 | templateGroup = ButtonGroup() 213 | templateGroup.add(pageBtn) 214 | templateGroup.add(componentBtn) 215 | templateGroup.add(customBtn) 216 | 217 | //empty placeholder 218 | template.add(JPanel()) 219 | 220 | return template 221 | } 222 | 223 | private fun setFunctionTab(main: JPanel, minor: JPanel, template: JPanel, container: Container) { 224 | val function = JPanel() 225 | function.border = BorderFactory.createTitledBorder("Select Function") 226 | 227 | //add tab 228 | val tab = JBTabbedPane() 229 | tab.addTab("Main", main) 230 | tab.addTab("Minor", minor) 231 | tab.addTab("Template", template) 232 | tab.addChangeListener { 233 | data.function.funTabIndex = tab.selectedIndex 234 | } 235 | tab.selectedIndex = data.function.funTabIndex 236 | 237 | function.add(tab) 238 | container.add(function) 239 | setSpacing(container) 240 | 241 | /// deal listener 242 | pageViewBox.addActionListener { 243 | if (disposeBox.isSelected && pageViewBox.isSelected) { 244 | disposeBox.isSelected = false 245 | } 246 | } 247 | disposeBox.addActionListener { 248 | if (disposeBox.isSelected && pageViewBox.isSelected) { 249 | pageViewBox.isSelected = false 250 | } 251 | } 252 | 253 | } 254 | 255 | /** 256 | * Generate file name and button 257 | */ 258 | private fun setModuleAndConfirm(container: Container) { 259 | //input module name 260 | //Row:Box.createHorizontalBox() | Column:Box.createVerticalBox() 261 | //add Module Name 262 | val nameField = JPanel() 263 | val padding = JPanel() 264 | padding.border = BorderFactory.createEmptyBorder(0, 0, 5, 0) 265 | nameField.border = BorderFactory.createTitledBorder("Module Name") 266 | nameTextField = JTextField(33) 267 | nameTextField.addKeyListener(keyListener) 268 | padding.add(nameTextField) 269 | nameField.add(padding) 270 | container.add(nameField) 271 | 272 | //OK cancel button 273 | val cancel = JButton("Cancel") 274 | cancel.foreground = JBColor.RED 275 | cancel.addActionListener(actionChangeListener) 276 | val ok = JButton("OK") 277 | ok.foreground = JBColor.BLUE 278 | ok.addActionListener(actionChangeListener) 279 | val menu = JPanel() 280 | menu.layout = FlowLayout() 281 | menu.add(cancel) 282 | menu.add(ok) 283 | menu.border = BorderFactory.createEmptyBorder(10, 0, 10, 0) 284 | 285 | container.add(menu) 286 | } 287 | 288 | /** 289 | * Set the overall pop-up style 290 | */ 291 | private fun setJDialog() { 292 | //The focus is on the current pop-up window, 293 | // and the focus will not shift even if you click on other areas 294 | jDialog.isModal = true 295 | //Set padding 296 | (jDialog.contentPane as JPanel).border = BorderFactory.createEmptyBorder(10, 10, 10, 10) 297 | //auto layout 298 | jDialog.pack() 299 | jDialog.setLocationRelativeTo(null) 300 | jDialog.isVisible = true 301 | } 302 | 303 | private fun setPadding(template: JRadioButton = JRadioButton()) { 304 | template.border = BorderFactory.createEmptyBorder(10, 0, 5, 100) 305 | } 306 | 307 | private fun setBottomPadding(template: JRadioButton) { 308 | template.border = BorderFactory.createEmptyBorder(5, 0, 0, 100) 309 | } 310 | 311 | private fun setMargin(box: JCheckBox) { 312 | box.border = BorderFactory.createEmptyBorder(10, 0, 5, 100) 313 | } 314 | 315 | private fun setBottomMargin(box: JCheckBox) { 316 | box.border = BorderFactory.createEmptyBorder(5, 0, 0, 100) 317 | } 318 | 319 | private fun setSpacing(container: Container) { 320 | val jPanel = JPanel() 321 | jPanel.border = BorderFactory.createEmptyBorder(0, 0, 3, 0) 322 | container.add(jPanel) 323 | } 324 | 325 | private fun confirm() { 326 | //data change, deal TextField listener 327 | getXListener.onDataChange(this) 328 | 329 | if (getXListener.onSave()) { 330 | dispose() 331 | } 332 | } 333 | 334 | private fun dispose() { 335 | jDialog.dispose() 336 | } 337 | } 338 | 339 | interface GetXListener { 340 | fun onSave(): Boolean 341 | 342 | fun onDataChange(view: NewGetXView) 343 | } -------------------------------------------------------------------------------- /src/main/kotlin/action/NewGetXAction.kt: -------------------------------------------------------------------------------- 1 | package action 2 | 3 | import com.google.common.base.CaseFormat 4 | import com.intellij.openapi.actionSystem.AnAction 5 | import com.intellij.openapi.actionSystem.AnActionEvent 6 | import com.intellij.openapi.actionSystem.PlatformDataKeys 7 | import com.intellij.openapi.project.Project 8 | import com.intellij.openapi.project.guessProjectDir 9 | import com.intellij.openapi.ui.Messages 10 | import helper.DataService 11 | import helper.GetXName 12 | import helper.TemplateInfo 13 | import java.io.* 14 | import java.util.* 15 | import kotlin.collections.HashMap 16 | 17 | 18 | class NewGetXAction : AnAction() { 19 | private var project: Project? = null 20 | private lateinit var psiPath: String 21 | private var data = DataService.instance 22 | 23 | /** 24 | * module name 25 | */ 26 | private lateinit var moduleName: String 27 | 28 | 29 | override fun actionPerformed(event: AnActionEvent) { 30 | project = event.project 31 | psiPath = event.getData(PlatformDataKeys.PSI_ELEMENT).toString() 32 | psiPath = psiPath.substring(psiPath.indexOf(":") + 1) 33 | initView() 34 | } 35 | 36 | private fun initView() { 37 | NewGetXView(object : GetXListener { 38 | override fun onSave(): Boolean { 39 | return save() 40 | } 41 | 42 | override fun onDataChange(view: NewGetXView) { 43 | //module name 44 | moduleName = view.nameTextField.text 45 | 46 | //deal default value 47 | val modelType = view.modeGroup.selection.actionCommand 48 | data.modeDefault = (GetXName.ModeDefault == modelType) 49 | data.modeEasy = (GetXName.ModeEasy == modelType) 50 | 51 | //function area 52 | data.function.useGetX5 = view.getX5Box.isSelected 53 | data.function.useFolder = view.folderBox.isSelected 54 | data.function.usePrefix = view.prefixBox.isSelected 55 | data.function.isPageView = view.pageViewBox.isSelected 56 | data.function.autoDispose = view.disposeBox.isSelected 57 | data.function.addLifecycle = view.lifecycleBox.isSelected 58 | data.function.addBinding = view.bindingBox.isSelected 59 | val templateType = view.templateGroup.selection.actionCommand 60 | val list = ArrayList().apply { 61 | add(data.templatePage.apply { selected = (GetXName.templatePage == templateType) }) 62 | add(data.templateComponent.apply { selected = (GetXName.templateComponent == templateType) }) 63 | add(data.templateCustom.apply { selected = (GetXName.templateCustom == templateType) }) 64 | } 65 | for (item in list) { 66 | if (!item.selected) continue 67 | data.module.logicName = item.logic 68 | data.module.stateName = item.state 69 | data.module.viewName = item.view 70 | data.module.viewFileName = item.viewFile 71 | break 72 | } 73 | } 74 | }) 75 | } 76 | 77 | /** 78 | * generate file 79 | */ 80 | private fun save(): Boolean { 81 | if ("" == moduleName.trim { it <= ' ' }) { 82 | Messages.showInfoMessage(project, "Please input the module name", "Info") 83 | return false 84 | } 85 | //Create a file 86 | createFile() 87 | //Refresh project 88 | project?.guessProjectDir()?.refresh(false, true) 89 | 90 | return true 91 | } 92 | 93 | private fun createFile() { 94 | val prefix = CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, upperCase(moduleName)) 95 | var folder = "" 96 | var prefixName = "" 97 | 98 | //add folder 99 | if (data.function.useFolder) { 100 | folder = "/$prefix" 101 | 102 | //use folder suffix 103 | if (data.setting.useFolderSuffix) { 104 | folder = "${folder}_${data.module.viewName.lowercase()}" 105 | } 106 | } 107 | 108 | //add prefix 109 | if (data.function.usePrefix) { 110 | prefixName = "${prefix}_" 111 | } 112 | 113 | //select generate file mode 114 | val path = psiPath + folder 115 | if (data.modeDefault) { 116 | generateDefault(path, prefixName) 117 | } else if (data.modeEasy) { 118 | generateEasy(path, prefixName) 119 | } 120 | 121 | //add binding file 122 | if (data.function.addBinding) { 123 | val inputFileName = if (data.function.useGetX5) { 124 | "binding_5.dart" 125 | } else { 126 | "binding_4.dart" 127 | } 128 | generateFile(inputFileName, path, "${prefixName}binding.dart") 129 | } 130 | } 131 | 132 | private fun generateDefault(path: String, prefixName: String) { 133 | generateFile("state.dart", path, "$prefixName${data.module.stateName.lowercase(Locale.getDefault())}.dart") 134 | generateFile("logic.dart", path, "$prefixName${data.module.logicName.lowercase(Locale.getDefault())}.dart") 135 | generateFile("view.dart", path, "$prefixName${data.module.viewFileName.lowercase(Locale.getDefault())}.dart") 136 | } 137 | 138 | private fun generateEasy(path: String, prefixName: String) { 139 | generateFile( 140 | "easy/logic.dart", path, "${prefixName}${data.module.logicName.lowercase(Locale.getDefault())}.dart" 141 | ) 142 | generateFile( 143 | "easy/view.dart", path, "${prefixName}${data.module.viewFileName.lowercase(Locale.getDefault())}.dart" 144 | ) 145 | } 146 | 147 | private fun generateFile(inputFileName: String, filePath: String, outFileName: String) { 148 | //content deal 149 | val content = dealContent(inputFileName) 150 | 151 | //Write file 152 | try { 153 | val folder = File(filePath) 154 | // if file not exists, then create it 155 | if (!folder.exists()) { 156 | folder.mkdirs() 157 | } 158 | val file = File("$filePath/$outFileName") 159 | if (!file.exists()) { 160 | file.createNewFile() 161 | } 162 | val fw = FileWriter(file.absoluteFile) 163 | val bw = BufferedWriter(fw) 164 | bw.write(content) 165 | bw.close() 166 | } catch (e: IOException) { 167 | e.printStackTrace() 168 | } 169 | } 170 | 171 | private var replaceContentMap = HashMap() 172 | 173 | //content need deal 174 | private fun dealContent(inputFileName: String): String { 175 | //module name 176 | val name = upperCase(moduleName) 177 | //Adding a prefix requires modifying the imported class name 178 | var prefixName = "" 179 | if (data.function.usePrefix) { 180 | prefixName = "${CaseFormat.LOWER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, name)}_" 181 | } 182 | 183 | //select suitable file, return suitable content 184 | var content = getSuitableContent(inputFileName) 185 | replaceContentMap.clear() 186 | 187 | //replace view file 188 | replaceView(inputFileName, prefixName) 189 | 190 | //replace logic file 191 | replaceLogic(inputFileName, prefixName) 192 | 193 | //replace binding file 194 | replaceBinding(inputFileName, prefixName) 195 | 196 | //replace state file 197 | replaceState(inputFileName) 198 | 199 | replaceContentMap["@name"] = name 200 | 201 | replaceContentMap.forEach { (key, value) -> 202 | content = content.replace(key.toRegex(), value) 203 | } 204 | 205 | return content 206 | } 207 | 208 | private fun replaceLogic(inputFileName: String, prefixName: String) { 209 | if (!inputFileName.contains("logic.dart")) { 210 | return 211 | } 212 | 213 | replaceContentMap["state.dart"] = "$prefixName${data.module.stateName.lowercase(Locale.getDefault())}.dart" 214 | replaceContentMap["Logic"] = data.module.logicName 215 | replaceContentMap["State"] = data.module.stateName 216 | replaceContentMap["state"] = data.module.stateName.lowercase(Locale.getDefault()) 217 | } 218 | 219 | private fun replaceView(inputFileName: String, prefixName: String) { 220 | if (!inputFileName.contains("view.dart")) { 221 | return 222 | } 223 | 224 | // deal getX5 225 | if (data.function.useGetX5) { 226 | replaceContentMap["Get.find"] = "Bind.find" 227 | replaceContentMap["Get.delete"] = "Bind.delete" 228 | } 229 | 230 | //deal binding function 231 | if (data.function.addBinding) { 232 | replaceContentMap["Get.put\\(@nameLogic\\(\\)\\)"] = "Get.find<@nameLogic>()" 233 | } 234 | 235 | //deal suffix of custom module name 236 | replaceContentMap["logic.dart"] = "$prefixName${data.module.logicName.lowercase(Locale.getDefault())}.dart" 237 | replaceContentMap["state.dart"] = "$prefixName${data.module.stateName.lowercase(Locale.getDefault())}.dart" 238 | 239 | replaceContentMap["Page"] = data.module.viewName 240 | replaceContentMap["Logic"] = data.module.logicName 241 | replaceContentMap["logic"] = data.module.logicName.lowercase(Locale.getDefault()) 242 | replaceContentMap["@nameState"] = "@name${data.module.stateName}" 243 | replaceContentMap["state"] = data.module.stateName.lowercase(Locale.getDefault()) 244 | } 245 | 246 | private fun replaceState(inputFileName: String) { 247 | if (!inputFileName.contains("state.dart")) { 248 | return 249 | } 250 | 251 | replaceContentMap["State"] = data.module.stateName 252 | } 253 | 254 | private fun replaceBinding(inputFileName: String, prefixName: String) { 255 | if (!inputFileName.contains("binding_4.dart") && !inputFileName.contains("binding_5.dart")) { 256 | return 257 | } 258 | 259 | if (data.function.addBinding) { 260 | replaceContentMap["Logic"] = data.module.logicName 261 | replaceContentMap["logic.dart"] = "$prefixName${data.module.logicName.lowercase(Locale.getDefault())}.dart" 262 | } 263 | } 264 | 265 | private fun getSuitableContent(inputFileName: String): String { 266 | //deal auto dispose or pageView 267 | var defaultFolder = "/templates/normal/" 268 | 269 | // view.dart 270 | if (inputFileName.contains("view.dart")) { 271 | if (data.function.autoDispose) { 272 | defaultFolder = "/templates/auto/" 273 | } 274 | 275 | if (data.function.isPageView) { 276 | defaultFolder = "/templates/pageView/" 277 | } 278 | } 279 | 280 | //add lifecycle 281 | if (data.function.addLifecycle && inputFileName.contains("logic.dart")) { 282 | defaultFolder = "/templates/lifecycle/" 283 | } 284 | 285 | //read file 286 | var content = "" 287 | try { 288 | val input = this.javaClass.getResourceAsStream("$defaultFolder$inputFileName") 289 | content = String(readStream(input!!)) 290 | } catch (e: Exception) { 291 | //some error 292 | } 293 | 294 | return content 295 | } 296 | 297 | @Throws(Exception::class) 298 | private fun readStream(inStream: InputStream): ByteArray { 299 | val outSteam = ByteArrayOutputStream() 300 | try { 301 | val buffer = ByteArray(1024) 302 | var len: Int 303 | while (inStream.read(buffer).apply { len = this } != -1) { 304 | outSteam.write(buffer, 0, len) 305 | println(String(buffer)) 306 | } 307 | } catch (_: IOException) { 308 | } finally { 309 | outSteam.close() 310 | inStream.close() 311 | } 312 | return outSteam.toByteArray() 313 | } 314 | 315 | private fun upperCase(str: String): String { 316 | return str.substring(0, 1).uppercase(Locale.getDefault()) + str.substring(1) 317 | } 318 | } 319 | -------------------------------------------------------------------------------- /src/main/resources/liveTemplates/getX.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 19 | 25 | 32 | 39 | 54 | 72 | 79 | 87 | 95 | 103 | 111 | 119 | 127 | 135 | 142 | 149 | 156 | 164 | 172 | 180 | 188 | 196 | 204 | 205 | 209 | 220 | 231 | 239 | 248 | 258 | 268 | 278 | 288 | 297 | 306 | 317 | 328 | 338 | 348 | 357 | 376 | 400 | --------------------------------------------------------------------------------