{"id":10008009,"date":"2023-06-28T11:01:10","date_gmt":"2023-06-28T03:01:10","guid":{"rendered":"https:\/\/ityet.com\/?p=10008009"},"modified":"2023-06-28T11:01:10","modified_gmt":"2023-06-28T03:01:10","slug":"intellij-idea-%e6%8f%92%e4%bb%b6%e5%bc%80%e5%8f%91-%e4%ba%ac%e4%b8%9c%e4%ba%91%e6%8a%80%e6%9c%af%e5%9b%a2%e9%98%9f","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=10008009","title":{"rendered":"Intellij IDEA \u63d2\u4ef6\u5f00\u53d1 | \u4eac\u4e1c\u4e91\u6280\u672f\u56e2\u961f"},"content":{"rendered":"<h2>\u5199\u5728\u524d\u9762<\/h2>\n<p>\u5f88\u591aidea\u63d2\u4ef6\u6587\u6863\u66f4\u591a\u7684\u662f\u4ecb\u7ecd\u5982\u4f55\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684idea\u63d2\u4ef6\uff0c\u672c\u7bc7\u6587\u7ae0\u4ece\u5f00\u53d1\u73af\u5883\u3001demo\u3001\u751f\u6001\u7ec4\u4ef6\u3001\u6dfb\u52a0\u4f9d\u8d56\u5305\u3001\u6e90\u7801\u89e3\u8bfb\u3001\u7f51\u7edc\u8bf7\u6c42\u3001\u6e32\u67d3\u6570\u636e\u3001\u9875\u9762\u4ea4\u4e92\u7b49\u65b9\u9762\u4ecb\u7ecd\uff0c\u662f\u4e00\u7bc7\u80fd\u591f\u6ee1\u8db3\u57fa\u672c\u7684\u63d2\u4ef6\u5f00\u53d1\u5de5\u7a0b\u8981\u6c42\u7684\u6587\u7ae0\u3002<\/p>\n<p>\u5982\u6709\u758f\u6f0f\u6b22\u8fce\u6307\u6b63\uff0c\u5982\u60f3\u6df1\u5165\u4e86\u89e3\u6b22\u8fce\u63a2\u8ba8\u3002<\/p>\n<h2>\u4e00\u3001\u7b80\u4ecb<\/h2>\n<p>IntelliJ IDEA \u4e0e IntelliJ Platform<\/p>\n<p>IntelliJ IDEA \u7b80\u79f0 IDEA\uff0c\u662f Jetbrains \u516c\u53f8\u65d7\u4e0b\u7684\u4e00\u6b3e JAVA \u5f00\u53d1\u5de5\u5177\uff0c\u652f\u6301 Java\u3001Scala\u3001Groovy \u7b49\u8bed\u8a00\u7684\u5f00\u53d1\uff0c\u540c\u65f6\u5177\u5907\u652f\u6301\u76ee\u524d\u4e3b\u6d41\u7684\u6280\u672f\u548c\u6846\u67b6\uff0c\u64c5\u957f\u4e8e\u4f01\u4e1a\u5e94\u7528\u3001\u79fb\u52a8\u5e94\u7528\u548c Web \u5e94\u7528\u7684\u5f00\u53d1\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u529f\u80fd\uff0c\u667a\u80fd\u4ee3\u7801\u52a9\u624b\u3001\u4ee3\u7801\u81ea\u52a8\u63d0\u793a\u3001\u91cd\u6784\u3001J2EE\u652f\u6301\u3001\u5404\u7c7b\u7248\u672c\u5de5\u5177(git\u3001svn\u7b49)\u3001JUnit\u3001CVS\u6574\u5408\u3001\u4ee3\u7801\u5206\u6790\u3001 \u521b\u65b0\u7684GUI\u8bbe\u8ba1\u7b49\u3002<\/p>\n<p>IntelliJ Platform \u662f\u4e00\u4e2a\u6784\u5efa IDE \u7684\u5f00\u6e90\u5e73\u53f0\uff0c\u57fa\u4e8e\u5b83\u6784\u5efa\u7684 IDE \u6709 IntelliJ IDEA\u3001WebStorm\u3001DataGrip\u3001\u4ee5\u53ca Android Studio \u7b49\u7b49\u3002IDEA \u63d2\u4ef6\u4e5f\u662f\u57fa\u4e8e IntelliJ Platform \u5f00\u53d1\u7684\u3002<\/p>\n<h2>\u4e8c\u3001\u5f00\u53d1\u73af\u5883\u642d\u5efa<\/h2>\n<p>\u6ce8\u610f\u5404\u8f6f\u4ef6\u7248\u672c\u8981\u5bf9\u5e94<\/p>\n<h3>1\u3001\u5f00\u53d1\u5de5\u5177<\/h3>\n<p>IDEA 2020.1 \u5404\u7248\u672c\u4e0b\u8f7d\u5730\u5740\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=lU0EzJouGj9G5nJRjf3rZw%3D%3D.viffAjpVGT0B51fkCOfAvfJKPrPACMlwDWsFi5wUhl4wMHKQmjo5GAgzaTQJ2ngV78UjPFS5fL6iEkegXe6%2FaQ%3D%3D\" rel=\"nofollow\">https:\/\/www.jetbrains.com\/idea\/download\/other.html<\/a>\/<br \/>gradle 6.1 \u5404\u7248\u672c\u4e0b\u8f7d\u5730\u5740\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=jSbf%2Bq%2FjcDSeZ3YvN4HWWw%3D%3D.lbTrdQXWP%2BOiPJ4k2Hkr6%2BL0WWuxtz9B8u%2F5nf2RzE0%3D\" rel=\"nofollow\">https:\/\/gradle.org\/releases\/<\/a>\/<br \/>org.jetbrains.intellij 0.4.22\/<br \/>jdk 1.8\/<br \/>\u9996\u5148\u770b\u4e00\u4e0b\u76ee\u524didea\u7248\u672c\u7684\u53d8\u52a8\uff0c\u627e\u5230\u81ea\u5df1\u5f53\u524didea\u5bf9\u5e94\u7684\u7248\u672c\u9700\u8981\u7684jdk\u7248\u672c\/<br \/><a href=\"https:\/\/link.segmentfault.com\/?enc=s7lYRffIlbtFi5OJma01uw%3D%3D.l1bldT5xEm8L1qExXQe8cVvT%2F%2BFXGja%2BMrs4UgiF4BN7UCb7EeTyQqMsPqlA5Ua43ft6IUXmUciAsIfmDx3Ulc7xY5opIjGq33UZU9rO4%2BjPgy%2B62I0QA9tY%2B00LMQDUnxO95ODIYrdsmjqDozMAF5NxLeNFX2gFq%2FU8Y9NFx7seFWvQsDe5R5YQ24t9TehN\" rel=\"nofollow\">https:\/\/plugins.jetbrains.com\/docs\/intellij\/build-number-rang&#8230;<\/a>\/<br \/>\u63a5\u4e0b\u6765\u9700\u8981\u627eidea\u5bf9\u5e94\u7248\u672c\u7684gradle\u7248\u672c\/<br \/><a href=\"https:\/\/link.segmentfault.com\/?enc=iaqlfunEppGXNqBpOhFM4A%3D%3D.f0T20jq0T9ik7f1Ld3uYm50kimAlAE6IVL2gAFcLOyNiU%2F9QeOA5l%2FNYDWq5s2rpmOYM%2BSemAAsn57GIP5NQFMF%2Bo1PjnjB%2FHhMAYYq3XjYzG1yX3pvYaya9pK0QdB9s\" rel=\"nofollow\">https:\/\/www.jetbrains.com\/legal\/third-party-software\/?product&#8230;<\/a>\/<br \/>\u6700\u540e\u5c31\u662f\u627e gradle\u7248\u672c\u5bf9\u5e94\u7684 org.jetbrains.intellij \u63d2\u4ef6\u7248\u672c\uff0c\u5728gradle-intellij-plugin\u63d2\u4ef6\u7684releases\u9875\u9762\uff0c\u8fd9\u91cc\u4f1a\u5728\u63cf\u8ff0\u4e2d\u6307\u51fa\u6709\u5404\u4e2a\u63d2\u4ef6\u7248\u672c\u5bf9\u5e94\u6700\u4f4e\u7684gradle\u7248\u672c\u3002\/<br \/><a href=\"https:\/\/link.segmentfault.com\/?enc=W921jctRT5KJB3iOJ4G0bA%3D%3D.t5BwdlgRr3MwDZR0jjq5b5qj6HRjdvi0jISFOqY2p2zu010nN6IfOKU0BfxC2aRc%2FG%2BaehXtZkT%2B4qoQel0g3PPQSO54%2F5Nmbi%2FbsR6Z4xA%3D\" rel=\"nofollow\">https:\/\/github.com\/JetBrains\/gradle-intellij-plugin\/releases?page=1<\/a>\/<br \/>\u6dfb\u52a0\u4f9d\u8d56\u5230gradel\u914d\u7f6e\u6587\u4ef6\uff0c\u83b7\u53d6\u76f8\u5173\u4f9d\u8d56\u914d\u7f6e\/<br \/><a href=\"https:\/\/link.segmentfault.com\/?enc=tNK3u6F1TKyf0afU6VadmQ%3D%3D.haPpSlJbM7R7Ctm4NwuiJyjDcAFnP7xWvWL3hkeGFNwB%2B1TFfVjXci%2FFYv3%2F7FG%2Fb1cAdf014hjkc3adHTxqwL7bCpcTPaNKkJMLRcqouv8%3D\" rel=\"nofollow\">https:\/\/mvnrepository.com\/artifact\/org.springframework\/spring&#8230;<\/a><\/p>\n<h3>2\u3001\u542f\u7528Plugin DevKit<\/h3>\n<p>Plugin DevKit \u662f IntelliJ \u7684\u4e00\u4e2a\u63d2\u4ef6\uff0c\u5b83\u4f7f\u7528 IntelliJ IDEA \u81ea\u5df1\u7684\u6784\u5efa\u7cfb\u7edf\u6765\u4e3a\u5f00\u53d1 IDEA \u63d2\u4ef6\u63d0\u4f9b\u652f\u6301\u3002\u5f00\u53d1 IDEA \u63d2\u4ef6\u4e4b\u524d\u9700\u8981\u5b89\u88c5\u5e76\u542f\u7528 Plugin DevKit \u3002\/<br \/>\u6253\u5f00 IDEA\uff0c\u5bfc\u822a\u5230 Settings | Plugins\uff0c\u82e5\u63d2\u4ef6\u5217\u8868\u4e2d\u6ca1\u6709 Plugin DevKit\uff0c\u70b9\u51fb Install JetBrains plugin\uff0c\u641c\u7d22\u5e76\u5b89\u88c5\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943777\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>3\u3001\u914d\u7f6eIntelliJ Platform Plugin SDK<\/h3>\n<p>IntelliJ Platform Plugin SDK \u5c31\u662f\u5f00\u53d1 IntelliJ \u5e73\u53f0\u63d2\u4ef6\u7684SDK, \u662f\u57fa\u4e8e JDK \u4e4b\u4e0a\u8fd0\u884c\u7684\uff0c\u7c7b\u4f3c\u4e8e\u5f00\u53d1 Android \u5e94\u7528\u9700\u8981 Android SDK\u3002\/<br \/>3.1\u5bfc\u822a\u5230 File | Project Structure\uff0c\u9009\u62e9\u5bf9\u8bdd\u6846\u5de6\u4fa7\u680f Platform Settings \u4e0b\u7684 SDKs<\/p>\n<p>3.2\u70b9\u51fb + \u6309\u94ae\uff0c\u5148\u9009\u62e9 JDK\uff0c\u6307\u5b9a JDK \u7684\u8def\u5f84\uff1b\u518d\u521b\u5efa IntelliJ Platform Plugin SDK\uff0c\u6307\u5b9a home path \u4e3a IDEA \u7684\u5b89\u88c5\u8def\u5f84\uff0c\u5982\u56fe<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943778\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u521b\u5efa\u597d IntelliJ Platform Plugin SDK \u540e\uff0c\u9009\u62e9\u5de6\u4fa7\u680f Project Settings \u4e0b\u7684 Projects\uff0c\u5728 Project SDK \u4e0b\u9009\u62e9\u521a\u521b\u5efa\u7684 IntelliJ Platform Plugin SDK\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943779\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>4\u3001\u8bbe\u7f6e\u6e90\u7801\u8def\u5f84\uff08\u53ef\u9009\uff09<\/h3>\n<p>4.1\u67e5\u770b build \u53f7\uff1a\u6253\u5f00 IDEA\uff0cHelp | About\uff0c\u67e5\u770b\u7248\u672c\u53f7\u53ca build \u53f7<\/p>\n<p>4.2IDEA Community \u6e90\u7801\uff08<a href=\"https:\/\/link.segmentfault.com\/?enc=kqRUuORjvGWJjLpOBMPiNA%3D%3D.hrHOidEqvYTJ2gSdGpmyMjAHU4RZgzxmntJijGe19%2BEUAedJ3oGmvYcBlrazogfJ%2BNBtOLWrTJqfQclBj1lU7syeWBPDLUSghhX%2BOLSBhGSznY4deAWsRInKGdatMtiH5%2BVdk5IwHibbM5G5wkzX0w%3D%3D\" rel=\"nofollow\">https:\/\/github.com\/JetBrains\/intellij-community\/\uff09\uff1a\u5207\u6362\u5230\u4e0e<\/a> build \u53f7\u76f8\u540c\u7684\u5206\u652f\uff0c\u70b9\u51fb Clone or download \u6309\u94ae\uff0c\u9009\u62e9 Download ZIP<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943780\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>4.3\u9009\u62e9\u5de5\u7a0b\u7ed3\u6784\u8bbe\u7f6e\u540e\u9009\u62e9SDKs-&gt;\u9009\u4e2d\u4e4b\u524d\u5728\u7b2c3\u6b65\u6dfb\u52a0\u7684sdk\u70b9\u51fbSourcePath\u540e\u6309\u5982\u4e0b1\u70b9\u51fb\u6dfb\u52a0\u4e00\u4e2asourcePath\uff0c\u9009\u62e9\u4e0a\u9762\u4e0b\u8f7d\u989d\u6e90\u7801\u540e\u70b9\u51fbOK\u3001\u70b9\u51fbApplay<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943781\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>4.4\u672a\u5b89\u88c5\u6e90\u7801\u65f6\u70b9\u51fb\u67d0\u4e00\u4e2aaction(NewModuleAction)\u4f1a\u770b\u5230\u5982\u4e0b\u6240\u793a\u9605\u8bfb\u8d77\u6765\u4f1a\u6bd4\u8f83\u6666\u6da9\u96be\u61c2\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943782\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>5\u3001Sandbox<\/h3>\n<p>IntelliJ IDEA \u63d2\u4ef6\u4ee5 Debug\/Run \u6a21\u5f0f\u8fd0\u884c\u65f6\u662f\u5728 SandBox \u4e2d\u8fdb\u884c\u7684\uff0c\u4e0d\u4f1a\u5f71\u54cd\u5f53\u524d\u7684 IntelliJ IDEA\uff1b\u4f46\u662f\u540c\u4e00\u53f0\u673a\u5668\u540c\u65f6\u5f00\u53d1\u591a\u4e2a\u63d2\u4ef6\u65f6\u9ed8\u8ba4\u4f7f\u7528\u7684\u540c\u4e00\u4e2a sandbox\uff0c\u5373\u5728\u521b\u5efa IntelliJ Platform SDK \u65f6\u9ed8\u8ba4\u6307\u5b9a\u7684 Sandbox Home<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943783\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u5982\u679c\u9700\u8981\u6bcf\u4e2a\u63d2\u4ef6\u7684\u5f00\u53d1\u73af\u5883\u662f\u76f8\u4e92\u72ec\u7acb\u7684\uff0c\u53ef\u4ee5\u521b\u5efa\u591a\u4e2a IntelliJ Platform SDK\uff0c\u4e3a Sandbox Home \u6307\u5b9a\u4e0d\u540c\u7684\u76ee\u5f55 \u3002<\/p>\n<h2>\u4e09\u3001\u5f00\u53d1\u4e00\u4e2a\u7b80\u5355\u63d2\u4ef6<\/h2>\n<p>\u63d2\u4ef6\u7684\u521b\u5efa\u3001\u914d\u7f6e\u3001\u8fd0\u884c\u3001\u6253\u5305\u6d41\u7a0b\uff0c\u4ee5\u53ca action<\/p>\n<h3>1\u3001\u521b\u5efa\u4e00\u4e2a\u63d2\u4ef6\u5de5\u7a0b<\/h3>\n<p>\u9009\u62e9 File | New | Project\uff0c\u5de6\u4fa7\u680f\u4e2d\u9009\u62e9 IntelliJ Platform Plugin \u5de5\u7a0b\u7c7b\u578b<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943784\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u70b9\u51fb Next\uff0c\u8bbe\u7f6e\u5de5\u7a0b\u540d\u79f0\u53ca\u4f4d\u7f6e\uff0c\u70b9\u51fb Finish \u5b8c\u6210\u521b\u5efa\u3002\u53ef\u4ee5\u5230 File | Project Structure \u6765\u81ea\u5b9a\u4e49\u5de5\u7a0b\u8bbe\u7f6e\u3002<\/p>\n<p>\u9664\u4e86\u5728idea\u521b\u5efa\u63d2\u4ef6\u9879\u76ee\u5916\uff0c\u6211\u4eec\u8fd8\u53ef\u4ee5\u4e0b\u8f7dgithub\u6a21\u677f\u4ee3\u7801\u8fdb\u884c\u4fee\u6539\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=Wd2T14SI9C6oLtM92tYbdw%3D%3D.T%2F9y6v3DVS3yLP%2BgwLsDxPP4UL1I9Epj2gV%2Fr10F%2FoaS50GFvu5VGFq3qEsKX149tfLaRTfu8OkhmviPsD7rBA%3D%3D\" rel=\"nofollow\">https:\/\/github.com\/JetBrains\/intellij-platform-plugin-template<\/a><\/p>\n<h3>2\u3001\u63d2\u4ef6\u5de5\u7a0b\u7ed3\u6784<\/h3>\n<p>\u63d2\u4ef6\u5de5\u7a0b\u5185\u5bb9\uff1a<\/p>\n<pre><code>PluginDemo\/\n    resources\/\n      META-INF\/\n        plugin.xml\n    src\/\n      com\/foo\/...\n      ...\n      ...\n\n<\/code><\/pre>\n<ul>\n<li>src \u5b9e\u73b0\u63d2\u4ef6\u529f\u80fd\u7684classes<\/li>\n<li>resources\/META-INF\/plugin.xml \u63d2\u4ef6\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u6307\u5b9a\u63d2\u4ef6\u540d\u79f0\u3001\u63cf\u8ff0\u3001\u7248\u672c\u53f7\u3001\u652f\u6301\u7684 IntelliJ IDEA \u7248\u672c\u3001\u63d2\u4ef6\u7684 components \u548c actions \u4ee5\u53ca\u8f6f\u4ef6\u5546\u7b49\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<h3>3\u3001plugin.xml<\/h3>\n<p>\u4e0b\u9762\u793a\u4f8b\u63cf\u8ff0\u4e86\u53ef\u5728 plugin.xml \u6587\u4ef6\u914d\u7f6e\u7684\u4e3b\u8981\u5143\u7d20\uff1a<\/p>\n<pre><code>&lt;idea-plugin&gt;\n  &lt;!-- \u63d2\u4ef6\u540d\u79f0\uff0c\u522b\u4eba\u5728\u5b98\u65b9\u63d2\u4ef6\u5e93\u641c\u7d22\u4f60\u7684\u63d2\u4ef6\u65f6\u4f7f\u7528\u7684\u540d\u79f0 --&gt;\n  &lt;name&gt;MyPlugin&lt;\/name&gt;\n  &lt;!-- \u63d2\u4ef6\u552f\u4e00id\uff0c\u4e0d\u80fd\u548c\u5176\u4ed6\u63d2\u4ef6\u9879\u76ee\u91cd\u590d\uff0c\u6240\u4ee5\u63a8\u8350\u4f7f\u7528com.xxx.xxx\u7684\u683c\u5f0f\n       \u63d2\u4ef6\u4e0d\u540c\u7248\u672c\u4e4b\u95f4\u4e0d\u80fd\u66f4\u6539\uff0c\u82e5\u6ca1\u6709\u6307\u5b9a\uff0c\u5219\u4e0e\u63d2\u4ef6\u540d\u79f0\u76f8\u540c --&gt;\n  &lt;id&gt;com.example.plugin.myplugin&lt;\/id&gt;\n  &lt;!-- \u63d2\u4ef6\u7684\u63cf\u8ff0 --&gt;\n  &lt;description&gt;my plugin description&lt;\/description&gt;\n  &lt;!-- \u63d2\u4ef6\u7248\u672c\u53d8\u66f4\u4fe1\u606f\uff0c\u652f\u6301HTML\u6807\u7b7e\uff1b\n       \u5c06\u5c55\u793a\u5728 settings | Plugins \u5bf9\u8bdd\u6846\u548c\u63d2\u4ef6\u4ed3\u5e93\u7684Web\u9875\u9762 --&gt;\n  &lt;change-notes&gt;Initial release of the plugin.&lt;\/change-notes&gt;\n  &lt;!-- \u63d2\u4ef6\u7248\u672c --&gt;\n  &lt;version&gt;1.0&lt;\/version&gt;\n  &lt;!-- \u4f9b\u5e94\u5546\u4e3b\u9875\u548cemail--&gt;\n  &lt;vendor url=&quot;http:\/\/www.jetbrains.com&quot; email=&quot;support@jetbrains.com&quot; \/&gt;\n  &lt;!-- \u63d2\u4ef6\u6240\u4f9d\u8d56\u7684\u5176\u4ed6\u63d2\u4ef6\u7684id --&gt;\n  &lt;depends&gt;MyFirstPlugin&lt;\/depends&gt;\n  &lt;!-- \u63d2\u4ef6\u517c\u5bb9IDEA\u7684\u6700\u5927\u548c\u6700\u5c0f build \u53f7\uff0c\u4e24\u4e2a\u5c5e\u6027\u53ef\u4ee5\u4efb\u9009\u4e00\u4e2a\u6216\u8005\u540c\u65f6\u4f7f\u7528\n       \u5b98\u7f51\u8be6\u7ec6\u4ecb\u7ecd\uff1ahttp:\/\/www.jetbrains.org\/intellij\/sdk\/docs\/basics\/getting_started\/build_number_ranges.html--&gt;\n  &lt;idea-version since-build=&quot;3000&quot; until-build=&quot;3999&quot;\/&gt;\n  &lt;!-- application components --&gt;\n  &lt;application-components&gt;\n    &lt;component&gt;\n      &lt;!-- \u7ec4\u4ef6\u63a5\u53e3 --&gt;\n      &lt;interface-class&gt;com.plugin.demo.Component1Interface&lt;\/interface-class&gt;\n      &lt;!-- \u7ec4\u4ef6\u7684\u5b9e\u73b0\u7c7b --&gt;\n      &lt;implementation-class&gt;com.plugin.demo.impl.Component1Impl&lt;\/implementation-class&gt;\n    &lt;\/component&gt;\n  &lt;\/application-components&gt;\n  &lt;!-- project components --&gt;\n  &lt;project-components&gt;\n    &lt;component&gt;\n      &lt;!-- \u63a5\u53e3\u548c\u5b9e\u73b0\u7c7b\u76f8\u540c --&gt;\n      &lt;interface-class&gt;com.plugin.demo.impl.Component2&lt;\/interface-class&gt;\n    &lt;\/component&gt;\n  &lt;\/project-components&gt;\n  &lt;!-- module components --&gt;\n  &lt;module-components&gt;\n    &lt;component&gt;\n      &lt;interface-class&gt;com.plugin.demo.impl.Component3&lt;\/interface-class&gt;\n    &lt;\/component&gt;\n  &lt;\/module-components&gt;\n  &lt;!-- Actions --&gt;\n  &lt;actions&gt;\n    ...\n  &lt;\/actions&gt;\n  &lt;!-- \u63d2\u4ef6\u5b9a\u4e49\u7684\u6269\u5c55\u70b9\uff0c\u4ee5\u4f9b\u5176\u4ed6\u63d2\u4ef6\u6269\u5c55\u8be5\u63d2\u4ef6 --&gt;\n  &lt;extensionPoints&gt;\n    ...\n  &lt;\/extensionPoints&gt;\n  &lt;!-- \u58f0\u660e\u8be5\u63d2\u4ef6\u5bf9IDEA core\u6216\u5176\u4ed6\u63d2\u4ef6\u7684\u6269\u5c55 --&gt;\n  &lt;extensions xmlns=&quot;com.intellij&quot;&gt;\n    ...\n  &lt;\/extensions&gt;\n&lt;\/idea-plugin&gt;\n\n<\/code><\/pre>\n<h3>4\u3001\u521b\u5efa Action<\/h3>\n<p>Action\u662f\u5b9e\u73b0\u63d2\u4ef6\u529f\u80fd\u7684\u7c7b\uff0c \u4e00\u4e2aAction\u7c7b\u9700\u8981\u7ee7\u627fAnAction\u5e76\u4e14\u5b9e\u73b0actionPerformed\u65b9\u6cd5\u3002\u5f53\u7528\u6237\u70b9\u51fb\u83dc\u5355\u6216\u8005\u5de5\u5177\u680f\u6309\u94ae\uff0c \u6309\u5feb\u6377\u952e\uff0c\u6216\u8005\u901a\u8fc7Help | Find Action\u70b9\u51fb\u65f6\uff0c IntelliJ Platform\u7cfb\u7edf\u4f1a\u56de\u8c03\u5bf9\u5e94Action\u7684actionPerformed\u65b9\u6cd5\u3002\/<br \/>\u4e00\u4e2a Action \u8868\u793a IDEA \u83dc\u5355\u91cc\u7684\u4e00\u4e2a menu item \u6216\u5de5\u5177\u680f\u4e0a\u7684\u4e00\u4e2a\u6309\u94ae\uff0c\u901a\u8fc7\u7ee7\u627f AnAction class \u5b9e\u73b0\uff0c\u5f53\u9009\u62e9\u4e00\u4e2a menu item \u6216\u70b9\u51fb\u5de5\u5177\u680f\u4e0a\u7684\u6309\u94ae\u65f6\uff0c\u5c31\u4f1a\u8c03\u7528 AnAction \u7c7b\u7684 actionPerformed \u65b9\u6cd5\u3002\/<br \/>\u5b9e\u73b0\u81ea\u5b9a\u4e49 Action \u5206\u4e24\u6b65\uff1a<\/p>\n<ul>\n<li>\u5b9a\u4e49\u4e00\u4e2a\u6216\u591a\u4e2a action<\/li>\n<li>\u6ce8\u518c action\uff0c\u5c06 item \u6dfb\u52a0\u5230\u83dc\u5355\u6216\u5de5\u5177\u680f\u4e0a<\/li>\n<\/ul>\n<h4>4.1\u3001\u5b9a\u4e49 Action<\/h4>\n<p>\u5b9a\u4e49\u4e00\u4e2a Java class\uff0c\u7ee7\u627f AnAction \u7c7b\uff0c\u5e76\u91cd\u5199 actionPerformed \u65b9\u6cd5\uff0c \u5982<\/p>\n<pre><code>public class ActionDemo extends AnAction {\n\n    public void actionPerformed(AnActionEvent event) {\n        Project project = event.getData(PlatformDataKeys.PROJECT);\n        Messages.showInputDialog(\n          project,\n          &quot;What is your name?&quot;,\n          &quot;Input your name&quot;,\n          Messages.getQuestionIcon());\n    }\n}\n\n<\/code><\/pre>\n<h4>4.2\u3001\u6ce8\u518c Action<\/h4>\n<p>\u5728 plugin.xml \u6587\u4ef6\u7684<code>&lt;actions&gt;<\/code>\u5143\u7d20\u5185\u6ce8\u518c<\/p>\n<pre><code>&lt;actions&gt;\n  &lt;group id=&quot;MyPlugin.SampleMenu&quot; text=&quot;Sample Menu&quot; description=&quot;Sample menu&quot;&gt;\n    &lt;add-to-group group-id=&quot;MainMenu&quot; anchor=&quot;last&quot;  \/&gt;\n       &lt;action id=&quot;Myplugin.ActionDemo&quot; class=&quot;Mypackage.ActionDemo&quot; text=&quot;Text Boxes&quot; description=&quot;A test menu item&quot; \/&gt;\n  &lt;\/group&gt;\n&lt;\/actions&gt;\n\n<\/code><\/pre>\n<ul>\n<li>&lt;action&gt;\u5143\u7d20\u4f1a\u5b9a\u4e49\u4e00\u4e2a action\uff0c\u6307\u5b9a action \u7684 id\u3001\u5b9e\u73b0\u7c7b\u3001\u663e\u793a\u6587\u672c\u3001\u63cf\u8ff0<\/li>\n<li>&lt;group&gt;\u5143\u7d20\u4f1a\u5b9a\u4e49\u4e00\u4e2a action group\uff08\u591a\u4e2aaction\uff09\uff0c\u8bbe\u7f6e action group \u7684 id\u3001\u6587\u672c\u3001\u63cf\u8ff0<\/li>\n<li>&lt;add-to-group&gt;\u5143\u7d20\u6307\u5b9a\u5176\u5916\u90e8 action \u6216 action group \u88ab\u6dfb\u52a0\u5230\u7684\u4f4d\u7f6e<\/li>\n<\/ul>\n<p>\u4e0a\u9762\u793a\u4f8b\u4f1a\u5b9a\u4e49\u4e00\u4e2a\u88ab\u6dfb\u52a0\u5230 IDEA \u4e3b\u83dc\u5355\u7684\u6700\u540e\u9762\u7684 \u201cSampleMenu\u201d \u7684\u83dc\u5355\uff0c\u70b9\u51fb\u8be5\u83dc\u5355\u5c06\u5f39\u51fa\u4e00\u4e2a \u201cText Boxes\u201d item\uff0c\u5982\u56fe<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943785\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h4>4.3\u3001\u5feb\u901f\u521b\u5efa Action<\/h4>\n<p>IntelliJ Platform \u63d0\u4f9b\u4e86 New Action \u5411\u5bfc\uff0c\u5b83\u4f1a\u5e2e\u52a9\u6211\u4eec\u521b\u5efa action class \u5e76\u914d\u7f6e plugin.xml \u6587\u4ef6\uff1a<\/p>\n<p>\u5728\u76ee\u6807 package \u4e0a\u53f3\u952e\uff0c\u9009\u62e9 New | Plugin DevKit | Action\uff1a<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943786\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<ul>\n<li>Action ID: action \u552f\u4e00 id\uff0c\u63a8\u8350 format: <a href=\"https:\/\/link.segmentfault.com\/?enc=p5VnHqddIVcGbgXiikGGcQ%3D%3D.IDPpmSpTmB2CdiYh5%2FjuLfTsGx4d8YDbFH%2Fg7uyxtdM%3D\" rel=\"nofollow\">PluginName.ID<\/a><\/li>\n<li>Class Name: \u8981\u88ab\u521b\u5efa\u7684 action class \u540d\u79f0<\/li>\n<li>Name: menu item \u7684\u6587\u672c<\/li>\n<li>Description: action \u63cf\u8ff0\uff0ctoolbar \u4e0a\u6309\u94ae\u7684\u63d0\u793a\u6587\u672c\uff0c\u53ef\u9009<\/li>\n<li>Add to Group\uff1a\u9009\u62e9\u65b0 action \u8981\u88ab\u6dfb\u52a0\u5230\u7684 action group\uff08Groups, Actions\uff09\u4ee5\u53ca\u76f8\u5bf9\u5176\u4ed6 actions \u7684\u4f4d\u7f6e\uff08Anchor\uff09<\/li>\n<li>Keyboard Shortcuts\uff1a\u6307\u5b9a action \u7684\u7b2c\u4e00\u548c\u7b2c\u4e8c\u5feb\u6377\u952e<\/li>\n<\/ul>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943787\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u6ce8\u610f\uff1a\u8be5\u5411\u5bfc\u53ea\u80fd\u5411\u4e3b\u83dc\u5355\u4e2d\u5df2\u5b58\u5728\u7684 action group \u6216\u5de5\u5177\u680f\u4e0a\u6dfb\u52a0 action\uff0c\u82e5\u8981\u521b\u5efa\u65b0\u7684 action group\uff0c\u8bf7\u53c2\u8003\u524d\u9762\u7684\u5185\u5bb9\u3002<\/p>\n<h3>5\u3001\u8fd0\u884c\u8c03\u8bd5\u63d2\u4ef6<\/h3>\n<p>\u8fd0\u884c\/\u8c03\u8bd5\u63d2\u4ef6\u53ef\u76f4\u63a5\u5728 IntelliJ IDEA \u8fdb\u884c\uff0c\u9009\u62e9 Run | Edit Configurations&#8230;\uff0c\u82e5\u5de6\u4fa7\u680f\u6ca1\u6709 Plugin \u7c7b\u578b\u7684 Configuration, \u70b9\u51fb\u53f3\u4e0a\u89d2 + \u6309\u94ae\uff0c\u9009\u62e9 Plugin \u7c7b\u578b, \u5982\u56fe<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943788\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>Use classpath of module \u9009\u62e9\u8981\u8c03\u8bd5\u7684 module\uff0c\u5176\u4f59\u914d\u7f6e\u4e00\u822c\u9ed8\u8ba4\u5373\u53ef\uff1b\u5207\u6362\u5230 Logs \u9009\u9879\u5361\uff0c\u5982\u679c\u52fe\u9009\u4e86 idea.log\uff0c\u8fd0\u884c\u63d2\u4ef6\u65f6 idea.log \u6587\u4ef6\u7684\u5185\u5bb9\u5c06\u8f93\u51fa\u5230 idea.log console\u3002<\/p>\n<p>\u8fd0\u884c\u63d2\u4ef6\u70b9\u51fb\u5de5\u5177\u680f\u4e0a\u8fd0\u884c\u6309\u94aeRun<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943789\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\">\/<br \/><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943790\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>6\u3001\u6253\u5305\u5b89\u88c5\u63d2\u4ef6<\/h3>\n<h4>6.1\u3001\u6253\u5305\u63d2\u4ef6<\/h4>\n<p>\u9009\u62e9 Build | Prepare Plugin Module \u2018module name\u2019 for Deployment \u6765\u6253\u5305\u63d2\u4ef6\uff1a<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943791\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>jar\u7c7b\u578b\u7684\u63d2\u4ef6\u5305\uff1a<\/p>\n<pre><code>    PluginDemo.jar\/\n      com\/xxx\/...\n      ...\n      ...\n      META-INF\/\n        plugin.xml\n\n<\/code><\/pre>\n<p>zip\u7c7b\u578b\u7684\u63d2\u4ef6\u5305\uff1a<\/p>\n<pre><code>PluginDemo.zip\/\n  lib\/\n    libxxx.jar\n    libbar.jar\n    PluginDemo.jar\/\n      com\/xxx\/...\n      ...\n      ...\n      META-INF\/\n        plugin.xml\n\n<\/code><\/pre>\n<h4>6.2\u3001\u5b89\u88c5\u63d2\u4ef6<\/h4>\n<p>\u5bfc\u822a\u5230 File | Settings | Plugins \u9875\u9762\uff0c\u70b9\u51fb Install plugin from disk&#8230;<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943792\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<ul>\n<li>\u9009\u62e9\u63d2\u4ef6\u5305\u7684\u4f4d\u7f6e\uff0c\u70b9\u51fb OK<\/li>\n<li>\u5728\u63d2\u4ef6\u5217\u8868\u4e2d\uff0c\u52fe\u9009\u63d2\u4ef6\u540d\u5b57\u540e\u9762\u7684 check-box \u6765\u542f\u7528\u63d2\u4ef6\uff0c\u70b9\u51fb OK<\/li>\n<li>\u91cd\u542f IDEA\/<br \/>Install JetBrains plugin&#8230; \u4ece JetBrains \u4ed3\u5e93\uff08<a href=\"https:\/\/link.segmentfault.com\/?enc=6HTkMFcfYg%2BVDNuB%2FNMJ7w%3D%3D.iT8jmRry9VdIRs5A4Yrb0zog6X8Kuo6A2mboegMS%2BELiZzo%2FsSeL5o6iAzuWAsIm3vQtvFl9WQ31C01NXYOrjVZdKQsGz6fk6OcCDE11XofyY1wXYfKc12GPhK9PZhdL\" rel=\"nofollow\">https:\/\/plugins.jetbrains.com\/\uff09\u4e2d\u5b89\u88c5\u63d2\u4ef6<\/a>\/<br \/>Browse repositories&#8230; \u6dfb\u52a0\u5e76\u7ba1\u7406\u81ea\u5df1\u7684\u4ed3\u5e93<\/li>\n<\/ul>\n<h2>\u56db\u3001Action\u5141\u8bb8\u6dfb\u52a0\u7684\u4f4d\u7f6e<\/h2>\n<p>\u8fd9\u4e2a\u65f6\u5019\u6211\u4eec\u4e86\u89e3\u7684\u90fd\u6bd4\u8f83\u6d45\u663e\u8fd8\u505c\u7559\u5728demo\u5c42\u9762\uff0c\u5982\u4f55\u8fdb\u884c\u6df1\u5165\u7684\u4e86\u89e3\u5462\uff1f<\/p>\n<p>eg:\u6211\u4eec\u600e\u4e48\u77e5\u9053\u90fd\u6709\u54ea\u4e9b action \u6216 action group \u53ef\u4ee5\u88ab\u6211\u4eec\u6dfb\u52a0\u5462\uff1f<\/p>\n<h3>1.\u6dfb\u52a0\u4e3b\u83dc\u5355MainMenu<\/h3>\n<p>1\u3001\u6211\u4eec\u53ef\u4ee5\u70b9\u51fb\u914d\u7f6egroup-id=&#8221;MainMenu&#8221;\u4e0b\u7684MainMenu<\/p>\n<pre><code>&lt;actions&gt;\n  &lt;group id=&quot;MyPlugin.SampleMenu&quot; text=&quot;Sample Menu&quot; description=&quot;Sample menu&quot;&gt;\n    &lt;add-to-group group-id=&quot;MainMenu&quot; anchor=&quot;last&quot;  \/&gt;\n       &lt;action id=&quot;Myplugin.Textboxes&quot; class=&quot;Mypackage.TextBoxes&quot; text=&quot;Text Boxes&quot; description=&quot;A test menu item&quot; \/&gt;\n  &lt;\/group&gt;\n&lt;\/actions&gt;\n\n<\/code><\/pre>\n<p>2\u3001\u8fdb\u5165PlatformActions.xml\u5982\u4e0b\u56fe\uff0c\u8fd9\u4e2a\u65f6\u5019\u4e0d\u96be\u770b\u51fa\u8fd9\u91cc\u5c31\u662f\u4e3b\u83dc\u5355\u7684\u7b2c\u4e00\u5217\u5b50\u83dc\u5355<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943793\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>3.\u8fd9\u4e2a\u65f6\u5019\u5982\u679c\u6211\u4eec\u60f3\u65b0\u5efa\u4e2a\u7c7b\u4f3c\u4e0eFile&#8211;&gt;New\u548cOpen\u7684\u83dc\u5355\u8be5\u600e\u4e48\u505a\u5462\uff1f<\/p>\n<p>3.1\u6211\u4eec\u5e94\u8be5\u5148\u5b9e\u73b0\u5e03\u5c40\uff0c\u6dfb\u52a0\u4e3b\u83dc\u5355MainMenu<\/p>\n<pre><code>  &lt;!-- Actions --&gt;\n    &lt;actions&gt;\n        &lt;group id=&quot;MainMenuActionGroup&quot; text=&quot;MainMenuActionGroup&quot; description=&quot;MainMenuActionGroup&quot; popup=&quot;true&quot;&gt;\n            &lt;add-to-group group-id=&quot;MainMenu&quot; anchor=&quot;after&quot; relative-to-action=&quot;HelpMenu&quot;\/&gt;\n            &lt;action id=&quot;OpenFile&quot; class=&quot;com.plugin.demo.action.MainMenuOpenFileAction&quot; text=&quot;Open&quot;\n                    description=&quot;\u4e3b\u83dc\u5355File\u4e0b\u7684Open\u5b50\u83dc\u5355&quot;\/&gt;\n            &lt;separator\/&gt;\n        &lt;\/group&gt;\n        &lt;group id=&quot;JavaNewProjectOrModuleGroup&quot; text=&quot;\u4e00\u7ea7\u83dc\u5355&quot; popup=&quot;true&quot;&gt;\n            &lt;add-to-group group-id=&quot;MainMenuActionGroup&quot; anchor=&quot;before&quot; relative-to-action=&quot;OpenFile&quot;\/&gt;\n            &lt;action id=&quot;NewProject&quot; class=&quot;com.intellij.ide.actions.NewProjectAction&quot;\/&gt;\n            &lt;action id=&quot;ImportProject&quot; class=&quot;com.intellij.ide.actions.ImportProjectAction&quot;\/&gt;\n            &lt;action id=&quot;ProjectFromVersionControl&quot;\nclass=&quot;com.intellij.openapi.wm.impl.welcomeScreen.ProjectFromVersionControlAction&quot;\/&gt;\n            &lt;separator\/&gt;\n            &lt;action id=&quot;NewModule&quot; class=&quot;com.intellij.openapi.roots.ui.configuration.actions.NewModuleAction&quot;\/&gt;\n            &lt;action id=&quot;ImportModule&quot; class=&quot;com.intellij.ide.actions.ImportModuleAction&quot;\/&gt;\n        &lt;\/group&gt;\n    &lt;\/actions&gt;\n\n<\/code><\/pre>\n<p>3.2\u5b9e\u73b0\u81ea\u5b9a\u4e49\u7684\u6253\u5f00\u6587\u4ef6<\/p>\n<p>\u5176\u5b9e\u662f\u901a\u8fc7\u4e0b\u9762\u7684action\u914d\u7f6e\u7684OpenFileAction\u627e\u5230\u6e90\u7801<\/p>\n<pre><code>&lt;action id=&quot;OpenFile&quot; class=&quot;com.intellij.ide.actions.OpenFileAction&quot; icon=&quot;AllIcons.Actions.Menu_open&quot;\/&gt;\n\n<\/code><\/pre>\n<p>\u5728\u5c06\u6e90\u7801\u62f7\u8d1d\u51fa\u6765\u7c98\u8d34\u5230\u81ea\u5df1\u7684action\u5185\u3002\u8fd9\u6837\u5c31\u53ef\u4ee5\u5b9e\u73b0\u81ea\u5df1\u7684\u4e3b\u83dc\u5355File\u4e0b\u7684Open\u5b50\u83dc\u5355<\/p>\n<p>3.3\u8fd9\u4e2a\u65f6\u5019\u6709\u4eba\u4f1a\u6709\u7591\u95ee\u6211\u4e0d\u77e5\u9053\u53bb\u54ea\u627eNew\u5bf9\u5e94\u7684action\u5440\uff1f<\/p>\n<p>\u8fd9\u4e2a\u65f6\u5019\u6211\u4eec\u901a\u8fc7\u754c\u9762\u53ef\u4ee5\u770b\u5230Project from Existing Sources&#8230;\uff0c\u8fd9\u91cc\u6211\u4eec\u5c31\u53ef\u4ee5\u53bb\u641c\u8fd9\u4e2a\u6587\u672c\u5440\u3002\u65e2\u7136\u663e\u793a\u5728\u9875\u9762\u4e0a\u3002\u5fc5\u7136\u6709\u5730\u65b9\u5b9a\u4e49\u4e86\u5b83\u3002 ActionBundle.properties<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943794\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u8fd9\u4e2a\u65f6\u5019\u6211\u4eec\u5728\u6839\u636e\u5bf9\u5e94\u7684action\u5b9a\u4e49\u7684\u6587\u672c\u5728\u53bb\u641c\u7d22\u5bf9\u5e94\u7684action\uff0ccom.intellij.ide.actions.ImportProjectAction<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943795\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>3.4\u8fd9\u4e2a\u65f6\u5019\u6211\u4eec\u5c06\u5bf9\u5e94\u7684action\u62f7\u8d1d\u5230\u81ea\u5df1\u7684\u63d2\u4ef6\u5b9a\u4e49\u7684\u914d\u7f6e\u4e0a\u4e5f\u5c31\u5f62\u6210\u4e863.1\u7684\u4e00\u7ea7\u548c\u4e8c\u7ea7\u83dc\u5355<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943796\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>2.\u6dfb\u52a0\u4e3b\u5de5\u5177\u680fMainToolBar<\/h3>\n<p>\u6dfb\u52a0\u4e3b\u5de5\u5177\u680fMainToolBar(\u5982\u679c\u4e0d\u6e05\u695a\u54ea\u91cc\u662f\u4e3b\u83dc\u5355\u3001\u4e3b\u5de5\u5177\u680f\u3001\u5bfc\u822a\u680f\u3001\u4e0a\u4e0b\u6587\u83dc\u5355\u3001\u5f39\u51fa\u83dc\u5355\u53c2\u8003<a href=\"https:\/\/link.segmentfault.com\/?enc=MRNUtmGttc8AKYgfu1cTvA%3D%3D.f%2FzYFP1B1TtXhx%2Bt0Z%2F0761qVwgecOW0dWvPdPn58jwcofCZWAQ7hu0MOQkTzXBRwoTQ%2FYjl%2FU2PaFbs1yil51Ey%2B6FEIWzbdyO%2FAJUKzlxSOvzuPnhwQPn0S7lm43bTxrzeX4xJNZ76O2WV%2BmZ8ftANqMLr0rbFopo3%2F62BzgFTDgVs12%2Bpq1lSYX9m7G9OQIzrfSIUqj%2FHER59pn4Q55N6m3lbUdjwryov%2FNdJMZDM48cIXYwvD5f%2BBVSnktt7b6QqN4DOI4KxKuSVgeus9%2Bqd6O2klTPkxqO7YG8O%2FwQ%3D\" rel=\"nofollow\">https:\/\/www.w3cschool.cn\/intellij6f1017d5aa6296e6c3bb8c666b1a&#8230;<\/a>)<\/p>\n<pre><code>   &lt;group&gt;\n            &lt;add-to-group group-id=&quot;MainToolBar&quot; anchor=&quot;before&quot; relative-to-action=&quot;SearchEverywhere&quot;\/&gt;\n            &lt;reference ref=&quot;MainMenuActionGroup&quot;&gt;&lt;\/reference&gt;\n        &lt;\/group&gt;\n\n<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943797\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>3\u3001\u6dfb\u52a0\u4e0a\u4e0b\u6587\u83dc\u5355ProjectViewPopupMenu<\/h3>\n<pre><code>   &lt;group&gt;\n            &lt;add-to-group group-id=&quot;ProjectViewPopupMenu&quot; anchor=&quot;before&quot; relative-to-action=&quot;WeighingNewGroup&quot;\/&gt;\n            &lt;reference ref=&quot;MainMenuActionGroup&quot;&gt;&lt;\/reference&gt;\n        &lt;\/group&gt; \n\n<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943798\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>4\u3001\u6dfb\u52a0\u5f39\u51fa\u83dc\u5355EditorPopupMenu<\/h3>\n<pre><code> &lt;!--\u6dfb\u52a0\u5230\u5f39\u51fa\u6846\u53f3\u952e--&gt;\n        &lt;group&gt;\n            &lt;add-to-group group-id=&quot;EditorPopupMenu&quot; anchor=&quot;before&quot; relative-to-action=&quot;ShowIntentionsGroup&quot;\/&gt;\n            &lt;reference ref=&quot;MainMenuActionGroup&quot;&gt;&lt;\/reference&gt;\n        &lt;\/group&gt;\n\n<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943799\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>5\u3001\u6dfb\u52a0\u6253\u5370ConsoleEditorPopupMenu<\/h3>\n<pre><code>    &lt;!--\u6dfb\u52a0\u5230\u63a7\u5236\u53f0\u6253\u5370\u53f3\u952e--&gt;\n        &lt;group&gt;\n            &lt;add-to-group group-id=&quot;ConsoleEditorPopupMenu&quot; anchor=&quot;before&quot; relative-to-action=&quot;CutCopyPasteGroup&quot;\/&gt;\n            &lt;reference ref=&quot;MainMenuActionGroup&quot;&gt;&lt;\/reference&gt;\n        &lt;\/group&gt;\n\n<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943800\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>6\u3001\u53f3\u952e\u65b0\u5efaaction\u65f6\u4e5f\u53ef\u4ee5\u76f4\u63a5\u9009\u62e9\u6dfb\u52a0\u7684\u4f4d\u7f6e\u3002<\/h3>\n<p>1.\u7b5b\u9009\u540e\u67e5\u627e\u8981\u6dfb\u52a0\u7684group\/<br \/>2.\u9009\u62e9\u5bf9\u5e94\u7684action\/<br \/>3.\u9009\u62e9\u8981\u6dfb\u52a0\u5230\u8fd9\u4e2aaction\u7684\u67d0\u4e2a\u4f4d\u7f6e<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943801\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h2>\u4e94\u3001Components(\u5df2\u4e0d\u5efa\u8bae\u4f7f\u7528)<\/h2>\n<p>IntelliJ IDEA \u7684\u7ec4\u4ef6\u6a21\u578b\u662f\u57fa\u4e8e PicoContainer \u7684\uff0c\u7ec4\u4ef6\u90fd\u5305\u542b\u5728\u8fd9\u4e9b\u5bb9\u5668\u4e2d\uff0c\u4f46\u5bb9\u5668\u6709\u4e09\u79cd\u7ea7\u522b\uff1aapplication container\uff0cproject container \u4ee5\u53ca module container\u3002application container \u53ef\u4ee5\u5305\u542b\u591a\u4e2a project container\uff0c\u800c project container \u53ef\u4ee5\u5305\u542b\u591a\u4e2a module container\u3002<\/p>\n<h3>1\u3001Components \u7c7b\u578b<\/h3>\n<p>Components \u662f\u63d2\u4ef6\u5f00\u53d1\u7684\u57fa\u7840\uff0cComponents \u6709\u4e09\u79cd\u7c7b\u578b\uff1a<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943802\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>2\u3001\u6ce8\u518c Components<\/h3>\n<p>components \u9700\u8981\u914d\u7f6e\u5728 plugin.xml \u4e2d\uff0c\u5e76\u6307\u5b9a interface \u548c implementation\uff0cinterface \u7c7b\u7528\u4e8e\u4ece\u5176\u4ed6\u7ec4\u4ef6\u4e2d\u68c0\u7d22\u7ec4\u4ef6\uff0cimplementation \u7c7b\u7528\u4e8e\u5b9e\u4f8b\u5316\u7ec4\u4ef6\u3002\u793a\u4f8b\uff1a<\/p>\n<pre><code>\/\/\u521b\u5efa\u4e00\u4e2a application level component\npublic interface Component1 extends ApplicationComponent {\n}\n\npublic class Component1Impl implements Component1 {\n\n    @Override\n    public String getComponentName() {\n        return &quot;PluginDemo.Component1&quot;;\n    }\n}\n\n<\/code><\/pre>\n<p>plugin.xml<\/p>\n<pre><code>&lt;application-components&gt;\n    &lt;component&gt;\n      &lt;interface-class&gt;com.example.test.Component1&lt;\/interface-class&gt;\n      &lt;implementation-class&gt;com.example.test.Component1Impl&lt;\/implementation-class&gt;\n    &lt;\/component&gt;\n &lt;\/application-components&gt;\n\n<\/code><\/pre>\n<p>\u6ce8\u610f\uff1a\u4e00\u4e2a interface-class \u4e0d\u80fd\u6709\u591a\u4e2a implementation-class\uff0c\u5982\u4e0b\u56fe\uff1a<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943803\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<ol>\n<li>\u82e5\u7ec4\u4ef6\u6ca1\u6709\u521b\u5efa interface \u7c7b\uff0c\u800c\u662f\u76f4\u63a5\u5b9e\u73b0\u4e86 ApplicationComponent \u7b49\u63a5\u53e3\uff0cinterface \u548c implementation \u53ef\u4ee5\u6307\u5b9a\u4e3a\u540c\u4e00\u4e2a\u7c7b\u3002<\/li>\n<li>\u6bcf\u4e00\u4e2a\u7ec4\u4ef6\u90fd\u5e94\u8be5\u6709\u4e00\u4e2a\u552f\u4e00\u7684\u540d\u5b57\uff0c\u901a\u8fc7 getComponentName() \u8fd4\u56de\uff0c\u63a8\u8350\u4f7f\u7528 \/&lt;plugin\/_name&gt;.\/&lt;component\/_name&gt; \u683c\u5f0f\u3002<\/li>\n<\/ol>\n<h3>3\u3001Component \u5468\u671f\u65b9\u6cd5<\/h3>\n<p>ApplicationComponent \u7684\u751f\u547d\u5468\u671f\u65b9\u6cd5\uff1a<\/p>\n<pre><code>\/\/\u6784\u9020\u65b9\u6cd5\npublic constructor(){\n}\n\/\/\u521d\u59cb\u5316\npublic void initComponent() {\n}\n\npublic void disposeComponent() {\n}\n\n<\/code><\/pre>\n<p>ProjectComponent \u7684\u751f\u547d\u5468\u671f\u65b9\u6cd5\uff1a<\/p>\n<pre><code>\/\/\u6784\u9020\u65b9\u6cd5\npublic constructor(){\n}\n\/\/\u901a\u77e5\u4e00\u4e2aproject\u5df2\u7ecf\u5b8c\u6210\u52a0\u8f7d\npublic void projectOpened() {\n}\n\npublic void projectClosed() {\n}\n\/\/\u6267\u884c\u521d\u59cb\u5316\u64cd\u4f5c\u4ee5\u53ca\u4e0e\u5176\u4ed6 components \u7684\u901a\u4fe1\npublic void initComponent() {\n}\n\/\/\u91ca\u653e\u7cfb\u7edf\u8d44\u6e90\u6216\u6267\u884c\u5176\u4ed6\u6e05\u7406\npublic void disposeComponent() {\n}\n\n<\/code><\/pre>\n<p>ModuleComponent \u7684\u751f\u547d\u5468\u671f\u65b9\u6cd5\uff1a<\/p>\n<p>ModuleComponent \u7684\u751f\u547d\u5468\u671f\u65b9\u6cd5\u4e2d\u6bd4 ProjectComponent \u591a\u4e00\u4e2a moduleAdded()\uff0c\u7528\u4e8e\u901a\u77e5 module \u5df2\u7ecf\u88ab\u6dfb\u52a0\u5230 project \u4e2d\u3002<\/p>\n<h3>4\u3001Component \u52a0\u8f7d<\/h3>\n<p>Application \u7ea7\u522b\u7684 components \u5728 IDEA \u542f\u52a8\u65f6\u52a0\u8f7d\uff0cProject \u548c Module \u7ea7\u522b\u7684 components \u5728\u9879\u76ee\u542f\u52a8\u65f6\u5171\u540c\u52a0\u8f7d\u3002<\/p>\n<p>\u4e00\u4e2a\u7ec4\u4ef6\u52a0\u8f7d\u8fc7\u7a0b\uff1a<\/p>\n<ol>\n<li>\u521b\u5efa\uff1a\u8c03\u7528\u6784\u9020\u65b9\u6cd5<\/li>\n<li>\u521d\u59cb\u5316\uff1a\u8c03\u7528 initComponent() \u65b9\u6cd5<\/li>\n<li>\u5982\u679c\u662f Project \u7ec4\u4ef6\uff0c\u4f1a\u8c03\u7528 projectOpened() \u65b9\u6cd5\uff1b \u5982\u679c\u662f Module \u7ec4\u4ef6\uff0c\u4f1a\u4f9d\u6b21\u8c03\u7528 moduleAdded() \u548c projectOpened() \u65b9\u6cd5<\/li>\n<\/ol>\n<p>\u5982\u679c component \u5728\u52a0\u8f7d\u65f6\u9700\u8981\u7528\u5230\u5176\u4ed6 component\uff0c\u6211\u4eec\u53ea\u9700\u5728\u8be5 component \u7684\u6784\u9020\u65b9\u6cd5\u7684\u53c2\u6570\u5217\u8868\u58f0\u660e\u5373\u53ef\uff0c\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0cIntelliJ IDEA \u4f1a\u6309\u6b63\u786e\u7684\u987a\u5e8f\u5b9e\u4f8b\u5316\u6240\u4f9d\u8d56\u7684 component\u3002<\/p>\n<p>\u793a\u4f8b\uff1a<\/p>\n<pre><code>public class MyComponent implements ApplicationComponent {\n    private final MyOtherComponent otherComponent;\n\n    public MyComponent(MyOtherComponent otherComponent) {\n       this.otherComponent = otherComponent;\n    }\n    ...\n}\n\n<\/code><\/pre>\n<h3>5\u3001Component \u5378\u8f7d<\/h3>\n<p>\u4e00\u4e2a\u7ec4\u4ef6\u5378\u8f7d\u8fc7\u7a0b\uff1a<\/p>\n<ol>\n<li>\u5982\u679c\u662f Project \u6216 Module \u7ec4\u4ef6\uff0c\u8c03\u7528 projectClosed()<\/li>\n<li>\u63a5\u4e0b\u6765 disposeComponent() \u5c06\u88ab\u8c03\u7528<\/li>\n<\/ol>\n<h3>6\u3001Component \u5bb9\u5668<\/h3>\n<p>\u524d\u9762\u6211\u4eec\u63d0\u5230\u6709\u4e09\u79cd\u4e0d\u540c\u7684\u5bb9\u5668\uff0capplication container \u5b9e\u73b0 Application \u63a5\u53e3; project container \u5b9e\u73b0 Project \u63a5\u53e3;<\/p>\n<p>module container \u5b9e\u73b0 Module \u63a5\u53e3\u3002\u6bcf\u4e00\u4e2a\u5bb9\u5668\u90fd\u6709\u81ea\u5df1\u7684\u65b9\u6cd5\u53bb\u83b7\u53d6\u5bb9\u5668\u5185\u7684 component\u3002<\/p>\n<p>\u83b7\u53d6 application \u5bb9\u5668\u53ca\u5176\u5185\u90e8\u7684\u7ec4\u4ef6\uff1a<\/p>\n<pre><code>\/\u83b7\u53d6application\u5bb9\u5668\nApplication application = ApplicationManager.getApplication();\n\/\/\u83b7\u53d6application\u5bb9\u5668\u4e2d\u7684\u7ec4\u4ef6\nMyComponent myComponent = application.getComponent(MyComponent.class);\n\n<\/code><\/pre>\n<p>\u83b7\u53d6 project \/ module \u5bb9\u5668\u53ca\u5176\u5185\u90e8\u7684\u7ec4\u4ef6\uff1a<\/p>\n<p>\u5728 component \u6784\u9020\u65b9\u6cd5\u7684\u53c2\u6570\u5217\u8868\u4e2d\u58f0\u660e\uff1a<\/p>\n<pre><code>public class MyComponent implements ProjectComponent {\nProject project;\npublic MyComponent(Project project){\nthis.project = project;\n}\n\npublic void initComponent() {\nOtherComponent otherComponent = project.getComponent(OtherComponent.class);\n}\n}\n\n<\/code><\/pre>\n<p>\u5728\u8fd9\u4e2a\u4f8b\u5b50\u4e2d\uff0c\u7ec4\u4ef6\u5728\u6784\u9020\u65b9\u6cd5\u4e2d\u83b7\u53d6\u4e86\u5bb9\u5668\u5bf9\u8c61\uff0c\u5c06\u5176\u4fdd\u5b58\uff0c\u7136\u540e\u5728 component \u5176\u4ed6\u5730\u65b9\u8fdb\u884c\u5f15\u7528\u3002<\/p>\n<h3>7\u3001 \u5404\u7ec4\u4ef6\u4f7f\u7528\u65f6\u673a<\/h3>\n<p>7.1\u521b\u5efa\u4e00\u4e2aApplicationComponent<\/p>\n<pre><code>package com.plugin.demo.component;\n\nimport com.intellij.openapi.components.ApplicationComponent;\n\n\/\/\u521b\u5efa\u4e00\u4e2a application level component\npublic interface ApplicationComponentDemo extends ApplicationComponent {\n}\n\n\npackage com.plugin.demo.component;\n\nimport com.intellij.openapi.application.Application;\nimport com.intellij.openapi.application.ApplicationManager;\n\npublic class ApplicationComponentDemoImpl implements ApplicationComponentDemo {\n\n    @Override\n    public String getComponentName() {\n        System.out.println(&quot;ApplicationComponentDemoImpl = &quot; +this.getClass().getName());\n        return this.getClass().getName();\n    }\n\n    \/\/\u521d\u59cb\u5316\n    public void initComponent() {\n        System.out.println(&quot;ApplicationComponentDemoImpl initComponent&quot; );\n    }\n\n    public void disposeComponent() {\n        \/\/\u83b7\u53d6application\u5bb9\u5668\n        Application application = ApplicationManager.getApplication();\n        \/\/\u83b7\u53d6application\u5bb9\u5668\u4e2d\u7684\u7ec4\u4ef6\n        ApplicationComponentDemoImpl myComponent = application.getComponent(ApplicationComponentDemoImpl.class);\n        System.out.println(&quot;disposeComponent = &quot; + myComponent.getComponentName());\n    }\n}\n\n<\/code><\/pre>\n<p>7.2 \u521b\u5efa\u4e00\u4e2aProjectComponent<\/p>\n<pre><code>package com.plugin.demo.component;\n\nimport com.intellij.openapi.application.Application;\nimport com.intellij.openapi.application.ApplicationManager;\nimport com.intellij.openapi.components.ProjectComponent;\nimport org.jetbrains.annotations.NotNull;\n\npublic class ProjectComponentDemo implements ProjectComponent {\n    @NotNull\n    @Override\n    public String getComponentName() {\n        \/\/\u83b7\u53d6application\u5bb9\u5668\n        Application application = ApplicationManager.getApplication();\n        \/\/\u83b7\u53d6application\u5bb9\u5668\u4e2d\u7684\u7ec4\u4ef6\n        ApplicationComponentDemoImpl myComponent = application.getComponent(ApplicationComponentDemoImpl.class);\n        System.out.println(&quot;ProjectComponentDemo = &quot; + myComponent.getComponentName());\n        return myComponent.getComponentName();\n    }\n\n    @Override\n    public void initComponent() {\n\/\/        \u83b7\u53d6application\u5bb9\u5668\n        Application application = ApplicationManager.getApplication();\n\/\/        \u83b7\u53d6application\u5bb9\u5668\u4e2d\u7684\u7ec4\u4ef6\n        ApplicationComponentDemo component = application.getComponent(ApplicationComponentDemo.class);\n        System.out.println(&quot;ApplicationComponentDemoImpl initComponent = &quot; + component.getComponentName());\n        System.out.println(&quot;ProjectComponentDemo initComponent&quot;);\n    }\n\n    @Override\n    public void disposeComponent() {\n        \/\/\u83b7\u53d6application\u5bb9\u5668\n        Application application = ApplicationManager.getApplication();\n        \/\/\u83b7\u53d6application\u5bb9\u5668\u4e2d\u7684\u7ec4\u4ef6\n        ApplicationComponentDemoImpl myComponent = application.getComponent(ApplicationComponentDemoImpl.class);\n        System.out.println(&quot;disposeComponent = &quot; + myComponent.getComponentName());\n    }\n}\n\n<\/code><\/pre>\n<p>7.3\u521b\u5efa\u4e00\u4e2aModuleComponent<\/p>\n<pre><code>package com.plugin.demo.component;\n\nimport com.intellij.openapi.application.Application;\nimport com.intellij.openapi.application.ApplicationManager;\nimport com.intellij.openapi.components.ApplicationComponent;\nimport com.intellij.openapi.module.ModuleComponent;\nimport com.intellij.openapi.project.Project;\nimport com.intellij.openapi.project.ProjectManager;\nimport org.jetbrains.annotations.NotNull;\n\npublic class ModuleComponentDemo implements ModuleComponent {\n\n\n    @NotNull\n    @Override\n    public String getComponentName() {\n        \/\/\u83b7\u53d6application\u5bb9\u5668\n        Application application = ApplicationManager.getApplication();\n        \/\/\u83b7\u53d6application\u5bb9\u5668\u4e2d\u7684\u7ec4\u4ef6\n        ApplicationComponentDemoImpl myComponent = application.getComponent(ApplicationComponentDemoImpl.class);\n        System.out.println(&quot;ApplicationComponentDemoImpl initComponent = &quot; + myComponent.getComponentName());\n        ProjectManager projectManager = ProjectManager.getInstance();\n        Project defaultProject = projectManager.getDefaultProject();\n        ProjectComponentDemo component = defaultProject.getComponent(ProjectComponentDemo.class);\n        System.out.println(&quot;ProjectComponentDemo initComponent&quot; + component.getComponentName());\n        return myComponent.getComponentName();\n    }\n\n    @Override\n    public void initComponent() {\n        System.out.println(&quot;ModuleComponentDemo initComponent&quot;);\n    }\n\n    @Override\n    public void disposeComponent() {\n        \/\/\u83b7\u53d6application\u5bb9\u5668\n        Application application = ApplicationManager.getApplication();\n        \/\/\u83b7\u53d6application\u5bb9\u5668\u4e2d\u7684\u7ec4\u4ef6\n        ApplicationComponentDemoImpl myComponent = application.getComponent(ApplicationComponentDemoImpl.class);\n        System.out.println(&quot;disposeComponent = &quot; + myComponent.getComponentName());\n    }\n}\n\n<\/code><\/pre>\n<p>7.4\u6ce8\u518c\u914d\u7f6eComponent<\/p>\n<pre><code> &lt;application-components&gt;   \n        &lt;component&gt;   \n             &lt;interface-class&gt;com.plugin.demo.component.ApplicationComponentDemo&lt;\/interface-class&gt;  \n             &lt;implementation-class&gt;com.plugin.demo.component.ApplicationComponentDemoImpl&lt;\/implementation-class&gt;    \n        &lt;\/component&gt;\n    &lt;\/application-components&gt;\n    &lt;project-components&gt;\n        &lt;component&gt;   \n             &lt;interface-class&gt;com.plugin.demo.component.ProjectComponentDemo&lt;\/interface-class&gt;  \n             &lt;implementation-class&gt;com.plugin.demo.component.ProjectComponentDemo&lt;\/implementation-class&gt;    \n        &lt;\/component&gt;\n    &lt;\/project-components&gt;\n    &lt;module-components&gt;\n        &lt;component&gt;   \n             &lt;interface-class&gt;com.plugin.demo.component.ModuleComponentDemo&lt;\/interface-class&gt;  \n             &lt;implementation-class&gt;com.plugin.demo.component.ModuleComponentDemo&lt;\/implementation-class&gt;    \n        &lt;\/component&gt;\n    &lt;\/module-components&gt;\n\n<\/code><\/pre>\n<p>7.5\u8fd0\u884c\u540e\u7684\u9884\u671f\u662f\u5148\u6267\u884c\u5e94\u7528\u5c42\u7ec4\u4ef6\uff0c\u5728\u6267\u884c\u5de5\u7a0b\u7ea7\u7ec4\u4ef6\uff0c\u5728\u6267\u884c\u6a21\u5757\u7ea7\u7ec4\u4ef6<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943804\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h2>\u516d\u3001Extensions and Extension Points<\/h2>\n<p>\u5982\u679c\u63d2\u4ef6\u9700\u8981\u6269\u5c55 IDEA Platform \u6216 \u5176\u4ed6\u63d2\u4ef6\u7684\u529f\u80fd\uff0c\u6216\u4e3a\u5176\u4ed6\u63d2\u4ef6\u63d0\u4f9b\u53ef\u4ee5\u6269\u5c55\u81ea\u5df1\u7684\u63a5\u53e3\uff0c\u90a3\u4e48\u5c31\u8981\u7528\u5230 extensions \u548c extension points\uff0c\u7528\u4e8e\u4e0e IDEA \u548c\u5176\u4ed6\u63d2\u4ef6\u4ea4\u4e92\u3002<\/p>\n<h3>1\u3001Extension points \u6269\u5c55\u70b9<\/h3>\n<p>extension point \u7528\u4e8e\u6570\u636e\u4fe1\u606f\u6269\u5c55\uff0c\u4f7f\u5176\u4ed6\u63d2\u4ef6\u53ef\u4ee5\u6269\u5c55\u672c\u63d2\u4ef6\u7684\u529f\u80fd\uff0c\u53ef\u901a\u8fc7plugin.xml \u7684 \u5143\u7d20\u58f0\u660e\uff0c\u5982\u4e0b\u793a\u4f8b\uff1a<\/p>\n<pre><code>&lt;extensionPoints&gt;\n    &lt;!--\u4f7f\u7528beanClass\u58f0\u660e--&gt;\n    &lt;extensionPoint name=&quot;MyExtensionPoint1&quot; beanClass=&quot;MyPackage.MyBeanClass&quot; area=&quot;IDEA_APPLICATION&quot;&gt;\n        &lt;with attribute=&quot;implementationClass&quot; implements=&quot;MyPackage.MyAbstractClass&quot;\/&gt;\n    &lt;\/extensionPoint&gt;\n    &lt;!--\u4f7f\u7528interface\u58f0\u660e--&gt;\n    &lt;extensionPoint name=&quot;MyExtensionPoint2&quot; interface=&quot;MyPlugin.MyInterface&quot; area=&quot;IDEA_PROJECT&quot; \/&gt;\n&lt;\/extensionPoints&gt;\n\n<\/code><\/pre>\n<ul>\n<li>name \u6307\u5b9a extension point \u7684\u540d\u5b57\uff0c\u5f53\u5176\u4ed6\u63d2\u4ef6\u6269\u5c55\u8be5extensionPoint\u65f6\uff0c\u9700\u8981\u6307\u5b9a\u8be5name<\/li>\n<li>area \u6709\u4e09\u79cd\u503c\uff0cIDEAAPPLICATION\uff0cIDEAPROJECT\uff0cIDEA\/_MODULE\uff0c\u6307\u5b9aextension point\u7684\u7ea7\u522b<\/li>\n<li>interface \u6307\u5b9a\u9700\u8981\u6269\u5c55\u6b64 extension point \u7684\u63d2\u4ef6\u5fc5\u987b\u8981\u5b9e\u73b0\u7684\u63a5\u53e3<\/li>\n<li>beanClass \u6307\u5b9a\u4e00\u4e2a\u7c7b\uff0c\u8be5\u7c7b\u6709\u4e00\u4e2a\u6216\u591a\u4e2a\u88ab @Attribute \u6ce8\u89e3\u7684\u5c5e\u6027<\/li>\n<li>\u58f0\u660e extension point \u6709\u4e24\u79cd\u65b9\u5f0f\uff0c\u6307\u5b9a beanClass \u6216 interface<\/li>\n<li>\u5982\u679c\u67d0\u4e2a\u5c5e\u6027\u9700\u8981\u662f\u67d0\u4e2a\u7c7b\u7684\u5b50\u7c7b\uff0c\u6216\u67d0\u4e2a\u63a5\u53e3\u7684\u5b9e\u73b0\u7c7b\uff0c\u9700\u8981\u901a\u8fc7 \u6307\u660e\u7c7b\u540d\u6216\u63a5\u53e3\u540d\u3002<\/li>\n<\/ul>\n<p>\u793a\u4f8b\u4e0a\u8ff0\u4ee3\u7801\u4e2d\u7684 MyExtensionPoint1 \u7684 beanClass\uff1a<\/p>\n<pre><code>public class MyBeanClass extends AbstractExtensionPointBean {\n  @Attribute(&quot;key&quot;)\n  public String key;\n\n  @Attribute(&quot;implementationClass&quot;)\n  public String implementationClass;\n\n  ...\n}\n\n<\/code><\/pre>\n<h3>2\u3001Extension \u6269\u5c55\u5176\u4ed6\u63d2\u4ef6\u529f\u80fd<\/h3>\n<p>\u5982\u679c\u63d2\u4ef6\u9700\u8981\u6269\u5c55 IntelliJ Platform \u6216\u5176\u4ed6\u63d2\u4ef6\u7684\u529f\u80fd\uff0c\u9700\u8981\u58f0\u660e\u4e00\u4e2a\u6216\u591a\u4e2a extension\u3002<\/p>\n<ol>\n<li>\u8bbe\u7f6e \u7684 defaultExtensionNs \u5c5e\u6027\u82e5\u662f\u6269\u5c55 IntelliJ Platform\uff0c\u8bbe\u4e3a com.intellij\u82e5\u662f\u6269\u5c55\u5176\u4ed6\u63d2\u4ef6\uff0c\u5219\u8bbe\u4e3a pluginId<\/li>\n<li>\u6307\u5b9a\u8981\u6269\u5c55\u54ea\u4e2a extension point\u5185\u90e8\u7684\u5b50\u6807\u7b7e\u7684\u540d\u5b57\u5fc5\u987b\u4e0e extension point \u7684 name \u5c5e\u6027\u76f8\u540c<\/li>\n<li>\u5982\u679c extension point<\/li>\n<\/ol>\n<ul>\n<li>\u662f\u901a\u8fc7 interface \u58f0\u660e\u7684\uff0c\u90a3\u4e48\u4f7f\u7528 implementation \u5c5e\u6027\u6307\u660e interface \u7684\u5b9e\u73b0\u7c7b<\/li>\n<li>\u662f\u901a\u8fc7 beanClass \u58f0\u660e\u7684\uff0c\u90a3\u4e48\u5c31\u8981\u4e3a beanClass \u4e2d\u88ab @Attribute \u6ce8\u89e3\u7684\u5c5e\u6027\u6307\u5b9a\u5c5e\u6027\u503c<\/li>\n<\/ul>\n<p>\u793a\u4f8b\uff1a<\/p>\n<pre><code>&lt;!-- \u6269\u5c55 interface \u58f0\u660e\u7684 extensionPoint --&gt;\n  &lt;extensions defaultExtensionNs=&quot;com.intellij&quot;&gt;\n    &lt;appStarter implementation=&quot;MyPackage.MyExtension1&quot; \/&gt;\n    &lt;applicationConfigurable implementation=&quot;MyPackage.MyExtension2&quot; \/&gt;\n  &lt;\/extensions&gt;\n\n  &lt;!-- \u6269\u5c55 beanClass \u58f0\u660e\u7684 extensionPoint --&gt;\n  &lt;extensions defaultExtensionNs=&quot;pluginId&quot;&gt;\n     &lt;MyExtensionPoint1 key=&quot;keyValue&quot; implementationClass=&quot;MyPackage.MyClassImpl&quot;&gt;&lt;\/MyExtensionPoint1&gt;\n  &lt;\/extensions&gt;\n\n<\/code><\/pre>\n<p>\u63d2\u4ef6\u7684 service \u7684\u5b9e\u73b0\u5c31\u662f\u6269\u5c55 IDEA Platform \u7684 applicationService \u6216 projectService \u4e24\u4e2a extension points<\/p>\n<h3>3\u3001\u83b7\u53d6 extension points<\/h3>\n<p>IntelliJ Platform \u7684\u90e8\u5206 extension points<\/p>\n<pre><code> &lt;extensionPoints&gt;\n    &lt;extensionPoint name=&quot;languageBundle&quot; beanClass=&quot;com.intellij.DynamicBundle$LanguageBundleEP&quot;\/&gt;\n    &lt;!--suppress PluginXmlValidity --&gt;\n    &lt;extensionPoint name=&quot;applicationService&quot; beanClass=&quot;com.intellij.openapi.components.ServiceDescriptor&quot; dynamic=&quot;true&quot;\/&gt;\n    &lt;!--suppress PluginXmlValidity --&gt;\n    &lt;extensionPoint name=&quot;projectService&quot; beanClass=&quot;com.intellij.openapi.components.ServiceDescriptor&quot; dynamic=&quot;true&quot;\/&gt;\n    &lt;!--suppress PluginXmlValidity --&gt;\n    &lt;extensionPoint name=&quot;moduleService&quot; beanClass=&quot;com.intellij.openapi.components.ServiceDescriptor&quot; dynamic=&quot;true&quot;\/&gt;\n    &lt;extensionPoint name=&quot;virtualFileManagerListener&quot; interface=&quot;com.intellij.openapi.vfs.VirtualFileManagerListener&quot; dynamic=&quot;true&quot;\/&gt;\n    &lt;extensionPoint name=&quot;vfs.asyncListener&quot; interface=&quot;com.intellij.openapi.vfs.AsyncFileListener&quot; dynamic=&quot;true&quot;\/&gt;\n\n    &lt;!-- only bundled plugin can define startupActivity --&gt;\n    &lt;extensionPoint name=&quot;startupActivity&quot; interface=&quot;com.intellij.openapi.startup.StartupActivity&quot;\/&gt;\n    &lt;extensionPoint name=&quot;postStartupActivity&quot; interface=&quot;com.intellij.openapi.startup.StartupActivity&quot; dynamic=&quot;true&quot;\/&gt;\n    &lt;extensionPoint name=&quot;backgroundPostStartupActivity&quot; interface=&quot;com.intellij.openapi.startup.StartupActivity&quot; dynamic=&quot;true&quot;\/&gt;\n\n    &lt;extensionPoint name=&quot;fileTypeDetector&quot; interface=&quot;com.intellij.openapi.fileTypes.FileTypeRegistry$FileTypeDetector&quot; dynamic=&quot;true&quot;\/&gt;\n    &lt;extensionPoint name=&quot;editorFactoryDocumentListener&quot; interface=&quot;com.intellij.openapi.editor.event.DocumentListener&quot; dynamic=&quot;true&quot;\/&gt;\n    &lt;extensionPoint name=&quot;multiHostInjector&quot; interface=&quot;com.intellij.lang.injection.MultiHostInjector&quot; area=&quot;IDEA_PROJECT&quot; dynamic=&quot;true&quot;\/&gt;\n    &lt;extensionPoint name=&quot;writingAccessProvider&quot; area=&quot;IDEA_PROJECT&quot; interface=&quot;com.intellij.openapi.vfs.WritingAccessProvider&quot; dynamic=&quot;true&quot;\/&gt;\n    &lt;extensionPoint name=&quot;metaLanguage&quot; interface=&quot;com.intellij.lang.MetaLanguage&quot;\/&gt;\n    &lt;extensionPoint name=&quot;lang.parserDefinition&quot; beanClass=&quot;com.intellij.lang.LanguageExtensionPoint&quot; dynamic=&quot;true&quot;&gt;\n      &lt;with attribute=&quot;implementationClass&quot; implements=&quot;com.intellij.lang.ParserDefinition&quot;\/&gt;\n    &lt;\/extensionPoint&gt;\n    &lt;extensionPoint name=&quot;lang.elementManipulator&quot; beanClass=&quot;com.intellij.openapi.util.ClassExtensionPoint&quot; dynamic=&quot;true&quot;&gt;\n      &lt;with attribute=&quot;implementationClass&quot; implements=&quot;com.intellij.psi.ElementManipulator&quot;\/&gt;\n    &lt;\/extensionPoint&gt;\n    &lt;!--suppress PluginXmlValidity --&gt;\n    &lt;extensionPoint name=&quot;stubElementTypeHolder&quot; beanClass=&quot;com.intellij.psi.stubs.StubElementTypeHolderEP&quot; dynamic=&quot;true&quot;\/&gt;\n  &lt;\/extensionPoints&gt;\n  &lt;extensions defaultExtensionNs=&quot;com.intellij&quot;&gt;\n    &lt;applicationService serviceInterface=&quot;com.intellij.util.messages.MessageBusFactory&quot;\n                        serviceImplementation=&quot;com.intellij.util.messages.impl.MessageBusFactoryImpl&quot;\/&gt;\n  &lt;\/extensions&gt;\n\n<\/code><\/pre>\n<p>\u5176\u4ed6\u53ef\u4ee5\u4ece\u88ab\u6269\u5c55\u63d2\u4ef6\u7684 plugin.xml \u6587\u4ef6\u4e2d\u83b7\u53d6\/<br \/><a href=\"https:\/\/link.segmentfault.com\/?enc=XXUF9toixw2aE9SFzAh77g%3D%3D.2VfM2IqkOtr123NhPd434AlMPBvGAAyttIPMOnPhgNMK8NPMz6EZIGguC%2BoaUKg0hMXYBku23LSf1cm67IHkT5u%2B8NzFpKuNw9p0M5899wg%3D\" rel=\"nofollow\">https:\/\/plugins.jetbrains.com\/intellij-platform-explorer\/exte&#8230;<\/a><\/p>\n<h2>\u4e03\u3001Service<\/h2>\n<p>\u53c2\u8003\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=cU7nPucabtx5mXOCYktHiA%3D%3D.G0xQ0%2BZqMVEzM9%2F5C2RumOlUJdstrZ3s2rAWRP9YbgbYp32%2Bc%2BJYXwq983rP1IcpjD4KkMQweCdtni00v01O12A5f1B6%2BMjKxhNuFSnYQqc%3D\" rel=\"nofollow\">https:\/\/plugins.jetbrains.com\/docs\/intellij\/plugin-services.h&#8230;<\/a><\/p>\n<p>Service \u4e5f\u662f\u4e00\u79cd\u6309\u9700\u52a0\u8f7d\u7684 component\uff0c\u5728\u8c03\u7528 ServiceManager.getService(Class)\u65f6\u624d\u4f1a\u52a0\u8f7d\uff0c\u4e14\u7a0b\u5e8f\u4e2d\u53ea\u6709\u4e00\u4e2a\u5b9e\u4f8b\u3002<\/p>\n<p>Service\u662f\u63d2\u4ef6\u7684\u4e00\u4e2a\u7ec4\u4ef6\uff0c \u662f\u4e3a\u4e86\u628a\u516c\u5171\u7684\u903b\u8f91\u653e\u5230\u4e00\u8d77\uff0cService\u7684\u5b9e\u4f8b\u662f\u5355\u4f8b\u7684\u3002<\/p>\n<p>Serivce \u5728 IntelliJ IDEA \u4e2d\u662f\u4ee5 extension point \u5f62\u5f0f\u63d0\u4f9b\u7684\uff0c\u5b9e\u73b0\u81ea\u5df1\u7684 service \u9700\u8981\u6269\u5c55\u76f8\u5e94 extension point\u3002<\/p>\n<ul>\n<li>applicationService: application level service<\/li>\n<li>projectService: project level service<\/li>\n<li>moduleService: module level service<\/li>\n<\/ul>\n<p>\u58f0\u660e service \u65f6\u5fc5\u987b\u5305\u542b serviceImplementation \u5c5e\u6027\u7528\u4e8e\u5b9e\u4f8b\u5316 service\uff0c serviceInterface \u5c5e\u6027\u662f\u53ef\u9009\u7684\uff0c\u53ef\u7528\u4e8e\u83b7\u53d6 service \u5b9e\u4f8b\u3002<\/p>\n<h3>1\u3001\u521b\u5efa Service<\/h3>\n<p>\u5728\u9700\u8981\u653e\u7f6e service \u7684 package \u4e0a\u53f3\u952e\uff0c New | Plugin DevKit | xxxxService\uff0c\u5982\u56fe<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943805\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u9009\u62e9\u76f8\u5e94 service\uff0c\u5f39\u51fa\u5982\u4e0b\u5bf9\u8bdd\u6846\uff0c\u586b\u5199 interface \u7c7b\u548c implementation \u7c7b\uff0c\u82e5\u4e0d\u52fe\u9009 Separate interface from implementation\uff0c\u53ea\u9700\u586b\u5199 implementation \u7c7b\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943806\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\">\/<br \/>IntelliJ IDEA \u4f1a\u81ea\u52a8\u521b\u5efa\u76f8\u5e94\u7c7b\u5e76\u914d\u7f6e plugin.xml \u6587\u4ef6\u3002\/<br \/>\u793a\u4f8b\uff1aplugin.xml\uff1a<\/p>\n<pre><code> &lt;extensions defaultExtensionNs=&quot;com.intellij&quot;&gt;\n        &lt;applicationService serviceInterface=&quot;com.plugin.demo.service.ApplicationServiceDemo&quot;\n                            serviceImplementation=&quot;com.plugin.demo.service.impl.ApplicationServiceDemoImpl&quot;\/&gt;\n        &lt;projectService serviceInterface=&quot;com.plugin.demo.service.ProjectServiceDemo&quot;\n                        serviceImplementation=&quot;com.plugin.demo.service.impl.ProjectServiceDemoImpl&quot;\/&gt;\n        &lt;moduleService serviceInterface=&quot;com.plugin.demo.service.ModuleServiceDemo&quot;\n                       serviceImplementation=&quot;com.plugin.demo.service.impl.ModuleServiceDemoImpl&quot;\/&gt;\n    &lt;\/extensions&gt;\n\n<\/code><\/pre>\n<p>\u751f\u6210\u7684 service \u7c7b\uff1a<\/p>\n<pre><code>public interface ApplicationServiceDemo {\n    static ApplicationServiceDemo getInstance() {\n        return ServiceManager.getService(ApplicationServiceDemo.class);\n    }\n}\npublic interface ProjectServiceDemo {\n    static ProjectServiceDemo getInstance(@NotNull Project project) {\n        return ServiceManager.getService(project, ProjectServiceDemo.class);\n    }\n}\npublic interface ModuleServiceDemo {\n    static ModuleServiceDemo getInstance(@NotNull Module module) {\n        return module.getService(ModuleServiceDemo.class);\n    }\n}\n\n<\/code><\/pre>\n<pre><code>public class ApplicationServiceDemoImpl implements ApplicationServiceDemo {\n\n    public ApplicationServiceDemoImpl() {\n        System.out.println(&quot;ApplicationServiceDemoImpl = &quot;);\n    }\n}\npublic class ProjectServiceDemoImpl implements ProjectServiceDemo {\n    public ProjectServiceDemoImpl(Project project) {\n\n        System.out.println(&quot;ProjectServiceDemoImpl = &quot; + project);\n    }\n}\npublic class ModuleServiceDemoImpl implements ModuleServiceDemo {\n    public ModuleServiceDemoImpl(Module project) {\n        System.out.println(&quot;ModuleServiceDemoImpl = &quot; + project);\n    }\n}\n\n<\/code><\/pre>\n<h3>2\u3001\u83b7\u53d6 Service<\/h3>\n<pre><code>MyApplicationService applicationService = ServiceManager.getService(MyApplicationService.class);\n\n\/\/\u83b7\u53d6 project \u7ea7\u522b\u7684 service\uff0c\u9700\u8981\u63d0\u4f9b project \u5bf9\u8c61\nMyProjectService projectService = ServiceManager.getService(project, MyProjectService.class);\n\n\/\/\u83b7\u53d6 module \u7ea7\u522b\u7684 service\uff0c\u9700\u8981\u63d0\u4f9b module \u5bf9\u8c61\nMyModuleService moduleService = ModuleServiceManager.getService(module, MyModuleService.class);\n\n<\/code><\/pre>\n<h2>\u516b\u3001\u6301\u4e45\u5316\u72b6\u6001<\/h2>\n<p>\u6211\u4eec\u5728\u4f7f\u7528 IDE \u5f00\u59cb\u5f00\u53d1\u5de5\u4f5c\u4e4b\u524d\uff0c\u603b\u662f\u8981\u5148\u5728 settings \u9875\u9762\u8fdb\u884c\u4e00\u4e9b\u8bbe\u7f6e\uff0c\u4e14\u6bcf\u6b21\u91cd\u65b0\u6253\u5f00 IDE \u540e\u8fd9\u4e9b\u8bbe\u7f6e\u4ecd\u7136\u4fdd\u7559\u7740\uff0c\u90a3\u4e48\u8fd9\u4e9b\u8bbe\u7f6e\u662f\u5982\u4f55\u4fdd\u5b58\u4e0b\u6765\u7684\u5462\uff1f<\/p>\n<p>IntelliJ Platform \u63d0\u4f9b\u4e86\u4e00\u4e9b API\uff0c\u53ef\u4ee5\u4f7f components \u6216 services \u5728\u6bcf\u6b21\u6253\u5f00 IDE \u65f6\u4ecd\u7136\u4f7f\u7528\u4e4b\u524d\u7684\u6570\u636e\uff0c\u5373\u6301\u4e45\u5316\u5176\u72b6\u6001\u3002<\/p>\n<h3>1\u3001PropertiesComponent<\/h3>\n<p>\u5bf9\u4e8e\u4e00\u4e9b\u7b80\u5355\u5c11\u91cf\u7684\u503c\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 PropertiesComponent\uff0c\u5b83\u53ef\u4ee5\u4fdd\u5b58 application \u7ea7\u522b\u548c project \u7ea7\u522b\u7684\u503c\u3002<\/p>\n<p>\u4e0b\u9762\u65b9\u6cd5\u7528\u4e8e\u83b7\u53d6 PropertiesComponent \u5bf9\u8c61\uff1a<\/p>\n<pre><code>\/\/\u83b7\u53d6 application \u7ea7\u522b\u7684 PropertiesComponent\nPropertiesComponent.getInstance()\n\/\/\u83b7\u53d6 project \u7ea7\u522b\u7684 PropertiesComponent\uff0c\u6307\u5b9a\u76f8\u5e94\u7684 project\nPropertiesComponent.getInstance(Project)\n\npropertiesComponent.setValue(name, value)\npropertiesComponent.getValue(name)\n\n<\/code><\/pre>\n<p>PropertiesComponent \u4fdd\u5b58\u7684\u662f\u952e\u503c\u5bf9\uff0c\u7531\u4e8e\u6240\u6709\u63d2\u4ef6\u4f7f\u7528\u7684\u662f\u540c\u4e00\u4e2a namespace\uff0c\u5f3a\u70c8\u5efa\u8bae\u4f7f\u7528\u524d\u7f00\u6765\u547d\u540d name\uff0c\u6bd4\u5982\u4f7f\u7528 plugin id\u3002<\/p>\n<h3>2\u3001PersistentStateComponent<\/h3>\n<p>PersistentStateComponent \u7528\u4e8e\u6301\u4e45\u5316\u6bd4\u8f83\u590d\u6742\u7684 components \u6216 services\uff0c\u53ef\u4ee5\u6307\u5b9a\u9700\u8981\u6301\u4e45\u5316\u7684\u503c\u3001\u503c\u7684\u683c\u5f0f\u4ee5\u53ca\u5b58\u50a8\u4f4d\u7f6e\u3002<\/p>\n<p>\u8981\u4f7f\u7528 PersistentStateComponent \u6301\u4e45\u5316\u72b6\u6001\uff1a<\/p>\n<ul>\n<li>\u9700\u8981\u63d0\u4f9b\u4e00\u4e2a PersistentStateComponent \u63a5\u53e3\u7684\u5b9e\u73b0\u7c7b\uff08component \u6216 service\uff09\uff0c\u6307\u5b9a\u7c7b\u578b\u53c2\u6570\uff0c\u91cd\u5199 getState() \u548c loadState() \u65b9\u6cd5<\/li>\n<li>\u7c7b\u578b\u53c2\u6570\u5c31\u662f\u8981\u88ab\u6301\u4e45\u5316\u7684\u7c7b\uff0c\u5b83\u53ef\u4ee5\u662f\u4e00\u4e2a bean class\uff0c\u4e5f\u53ef\u4ee5\u662f PersistentStateComponent\u5b9e\u73b0\u7c7b\u672c\u8eab\u3002<\/li>\n<li>\u5728 PersistentStateComponent \u7684\u5b9e\u73b0\u7c7b\u4e0a\uff0c\u901a\u8fc7 @com.intellij.openapi.components.State \u6ce8\u89e3\u6307\u5b9a\u5b58\u50a8\u7684\u4f4d\u7f6e<\/li>\n<\/ul>\n<p>\u4e0b\u9762\u901a\u8fc7\u4e24\u4e2a\u4f8b\u5b50\u8fdb\u884c\u8bf4\u660e\uff1a<\/p>\n<pre><code>class MyService implements PersistentStateComponent&lt;MyService.State&gt; {\n  \/\/\u8fd9\u91cc state \u662f\u4e00\u4e2a bean class\n  static class State {\n    public String value;\n    ...\n  }\n\n  \/\/\u7528\u4e8e\u4fdd\u5b58\u5f53\u524d\u7684\u72b6\u6001\n  State myState;\n\n  \/\/ \u4ece\u5f53\u524d\u5bf9\u8c61\u91cc\u83b7\u53d6\u72b6\u6001\n  public State getState() {\n    return myState;\n  }\n  \/\/ \u4ece\u5916\u90e8\u52a0\u8f7d\u72b6\u6001\uff0c\u8bbe\u7f6e\u7ed9\u5f53\u524d\u5bf9\u8c61\u7684\u76f8\u5e94\u5b57\u6bb5\n  public void loadState(State state) {\n    myState = state;\n  }\n}\n\n<\/code><\/pre>\n<pre><code>\/\/ \u8fd9\u91cc\u7684 state \u5c31\u662f\u5b9e\u73b0\u7c7b\u672c\u8eab\nclass MyService implements PersistentStateComponent&lt;MyService&gt; {\n  public String stateValue;\n  ...\n\n  public MyService getState() {\n    return this;\n  }\n\n  public void loadState(MyService state) {\n    XmlSerializerUtil.copyBean(state, this);\n  }\n}\n\n<\/code><\/pre>\n<h4>2.1\u3001\u5b9e\u73b0 State \u7c7b<\/h4>\n<p>a\u3001\u5b57\u6bb5\u8981\u6c42<\/p>\n<p>state \u7c7b\u4e2d\u53ef\u80fd\u6709\u591a\u4e2a\u5b57\u6bb5\uff0c\u4f46\u4e0d\u662f\u6240\u6709\u5b57\u6bb5\u90fd\u53ef\u4ee5\u88ab\u6301\u4e45\u5316\uff0c\u53ef\u4ee5\u88ab\u6301\u4e45\u5316\u7684\u5b57\u6bb5\uff1a<\/p>\n<ul>\n<li>public \u5b57\u6bb5<\/li>\n<li>bean \u5c5e\u6027\uff1a\u63d0\u4f9b getter \u548c setter \u65b9\u6cd5<\/li>\n<li>\u88ab\u6ce8\u89e3\u7684\u79c1\u6709\u5b57\u6bb5\uff1a\u4f7f\u7528 @Tag, @Attribute, @Property, @MapAnnotation, @AbstractCollection \u7b49\u6ce8\u89e3\u6765\u81ea\u5b9a\u4e49\u5b58\u50a8\u683c\u5f0f\uff0c\u4e00\u822c\u5728\u5b9e\u73b0\u5411\u540e\u517c\u5bb9\u65f6\u624d\u8003\u8651\u4f7f\u7528\u8fd9\u4e9b\u6ce8\u89e3<\/li>\n<\/ul>\n<p>\u8fd9\u4e9b\u5b57\u6bb5\u4e5f\u6709\u7c7b\u578b\u8981\u6c42\uff1a<\/p>\n<ul>\n<li>\u6570\u5b57\uff08\u5305\u62ec\u57fa\u7840\u7c7b\u578b\uff0c\u5982int\uff0c\u548c\u5c01\u88c5\u7c7b\u578b\uff0c\u5982Integer\uff09<\/li>\n<li>\u5e03\u5c14\u503c<\/li>\n<li>\u5b57\u7b26\u4e32<\/li>\n<li>\u96c6\u5408<\/li>\n<li>map<\/li>\n<li>\u679a\u4e3e<\/li>\n<\/ul>\n<p>\u5982\u679c\u4e0d\u5e0c\u671b\u67d0\u4e2a\u5b57\u6bb5\u88ab\u6301\u4e45\u5316\uff0c\u53ef\u4ee5\u4f7f\u7528 @com.intellij.util.xmlb.annotations.Transient \u6ce8\u89e3\u3002<\/p>\n<p>b\u3001\u6784\u9020\u5668\u8981\u6c42<\/p>\n<p>state \u7c7b\u5fc5\u987b\u6709\u4e00\u4e2a\u9ed8\u8ba4\u6784\u9020\u5668\uff0c\u8fd9\u4e2a\u6784\u9020\u5668\u8fd4\u56de\u7684 state \u5bf9\u8c61\u88ab\u8ba4\u4e3a\u662f\u9ed8\u8ba4\u72b6\u6001\uff0c\u53ea\u6709\u5f53\u5f53\u524d\u72b6\u6001\u4e0e\u9ed8\u8ba4\u72b6\u6001\u4e0d\u540c\u65f6\uff0c\u72b6\u6001\u624d\u4f1a\u88ab\u6301\u4e45\u5316\u3002<\/p>\n<h4>2.2\u3001\u5b9a\u4e49\u5b58\u50a8\u4f4d\u7f6e<\/h4>\n<p>\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528 @State \u6ce8\u89e3\u6765\u5b9a\u4e49\u5b58\u50a8\u4f4d\u7f6e<\/p>\n<pre><code>@State(name = &quot;PersistentDemo&quot;, storages = {@Storage(value = &quot;PluginDemo.xml&quot;)})\npublic class PersistentDemo implements PersistentStateComponent&lt;PersistentDemo&gt; {\n  ...\n}\n\n<\/code><\/pre>\n<p>name\uff1a \u5b9a\u4e49 xml \u6587\u4ef6\u6839\u6807\u7b7e\u7684\u540d\u79f0<\/p>\n<p>storages\uff1a \u4e00\u4e2a\u6216\u591a\u4e2a @Storage\uff0c\u5b9a\u4e49\u5b58\u50a8\u7684\u4f4d\u7f6e<\/p>\n<ul>\n<li>\u82e5\u662f application \u7ea7\u522b\u7684\u7ec4\u4ef6\u8fd0\u884c\u8c03\u8bd5\u65f6 xml \u6587\u4ef6\u7684\u4f4d\u7f6e\uff1a \/~\/IdeaICxxxx\/system\/plugins-sandbox\/config\/options\u6b63\u5f0f\u73af\u5883\u65f6 xml \u6587\u4ef6\u7684\u4f4d\u7f6e\uff1a \/~\/IdeaICxxxx\/config\/options<\/li>\n<li>\u82e5\u662f project \u7ea7\u522b\u7684\u7ec4\u4ef6\uff0c\u9ed8\u8ba4\u4e3a\u9879\u76ee\u7684 .idea\/misc.xml\uff0c\u82e5\u6307\u5b9a\u4e3a StoragePathMacros.WORKSPACE\/_FILE\uff0c\u5219\u4f1a\u88ab\u4fdd\u5b58\u5728 .idea\/worksapce.xml<\/li>\n<\/ul>\n<h4>2.3\u3001\u751f\u547d\u5468\u671f<\/h4>\n<ul>\n<li>loadState() \u5f53\u7ec4\u4ef6\u88ab\u521b\u5efa\u6216 xml \u6587\u4ef6\u88ab\u5916\u90e8\u6539\u53d8\uff08\u6bd4\u5982\u88ab\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u66f4\u65b0\uff09\u65f6\u88ab\u8c03\u7528<\/li>\n<li>getState() \u5f53 settings \u88ab\u4fdd\u5b58\uff08\u6bd4\u5982settings\u7a97\u53e3\u5931\u53bb\u7126\u70b9\uff0c\u5173\u95edIDE\uff09\u65f6\uff0c\u8be5\u65b9\u6cd5\u4f1a\u88ab\u8c03\u7528\u5e76\u4fdd\u5b58\u72b6\u6001\u503c\u3002\u5982\u679c getState() \u8fd4\u56de\u7684\u72b6\u6001\u4e0e\u9ed8\u8ba4\u72b6\u6001\u76f8\u540c\uff0c\u90a3\u4e48\u4ec0\u4e48\u90fd\u4e0d\u4f1a\u88ab\u4fdd\u5b58\u3002<\/li>\n<li>noStateLoaded() \u8be5\u65b9\u6cd5\u4e0d\u662f\u5fc5\u987b\u5b9e\u73b0\u7684\uff0c\u5f53\u521d\u59cb\u5316\u7ec4\u4ef6\uff0c\u4f46\u662f\u6ca1\u6709\u72b6\u6001\u88ab\u6301\u4e45\u5316\u65f6\u4f1a\u88ab\u8c03\u7528<\/li>\n<\/ul>\n<h4>2.4\u3001\u7ec4\u4ef6\u58f0\u660e<\/h4>\n<p>\u6301\u4e45\u5316\u7ec4\u4ef6\u53ef\u4ee5\u58f0\u660e\u4e3a component\uff0c\u4e5f\u53ef\u4ee5\u58f0\u660e\u4e3a service<\/p>\n<p>\u58f0\u660e\u4e3a service\uff0cplugin.xml \u6587\u4ef6\u5982\u4e0b\u914d\u7f6e\uff1a<\/p>\n<pre><code>&lt;extensions defaultExtensionNs=&quot;com.intellij&quot;&gt;\n    &lt;applicationService serviceImplementation=&quot;com.example.test.persisting.PersistentDemo&quot;\/&gt;\n    &lt;projectService serviceImplementation=&quot;com.example.test.persisting.PersistentDemo2&quot;\/&gt;\n  &lt;\/extensions&gt;\n\n<\/code><\/pre>\n<p>\u4ee3\u7801\u4e2d\u83b7\u53d6\u72b6\u6001\u4e0e\u83b7\u53d6 service \u7684\u65b9\u5f0f\u4e00\u6837\uff1a<\/p>\n<pre><code>PersistentDemo persistDemo = ServiceManager.getService(PersistentDemo.class);\nPersistentDemo2 persistDemo2 = ServiceManager.getService(project\uff0cPersistentDemo.class);\n\n<\/code><\/pre>\n<p>\u58f0\u660e\u4e3a component\uff0cplugin.xml \u6587\u4ef6\u5982\u4e0b\u914d\u7f6e\uff1a<\/p>\n<pre><code>&lt;application-components&gt;\n  &lt;!--\u5c06\u6301\u4e45\u5316\u7ec4\u4ef6\u58f0\u660e\u4e3acomponent--&gt;\n  &lt;component&gt;\n    &lt;implementation-class&gt;com.example.persistentdemo.PersistentComponent&lt;\/implementation-class&gt;\n  &lt;\/component&gt;\n&lt;\/application-components&gt;\n\n<\/code><\/pre>\n<p>\u83b7\u53d6\u72b6\u6001\u4e0e\u83b7\u53d6 component \u7684\u65b9\u5f0f\u4e00\u6837\uff1a<\/p>\n<pre><code>public static PersistentComponent getInstance() {\n    return ApplicationManager.getApplication().getComponent(PersistentComponent.class);\n}\npublic static PersistentComponent getInstance(Project project) {\n    return project.getComponent(PersistentComponent.class);\n}\n\n<\/code><\/pre>\n<h2>\u4e5d\u3001\u63d2\u4ef6\u4f9d\u8d56<\/h2>\n<p>\u5f00\u53d1\u63d2\u4ef6\u65f6\u53ef\u80fd\u4f1a\u7528\u5230\u5176\u4ed6\u63d2\u4ef6\uff0c\u53ef\u80fd\u662f IDEA \u7ed1\u5b9a\u7684\uff0c\u4e5f\u53ef\u80fd\u662f\u7b2c\u4e09\u65b9\u7684\u63d2\u4ef6\u3002<\/p>\n<p>\u914d\u7f6e\u63d2\u4ef6\u4f9d\u8d56\u9700\u8981\u5c06\u63d2\u4ef6\u5305\u6dfb\u52a0\u5230 SDK \u7684 classpath \u4e2d\uff0c\u5e76\u5728 plugin.xml \u914d\u7f6e\u3002<\/p>\n<ol>\n<li>\u786e\u5b9a\u63d2\u4ef6\u5305\u7684\u4f4d\u7f6e\u5982\u679c\u63d2\u4ef6\u662f IDEA \u6346\u7ed1\u7684\u63d2\u4ef6\uff0c\u90a3\u4e48\u63d2\u4ef6\u5305\u5728 IDEA \u5b89\u88c5\u76ee\u5f55\u7684 plugins\/ \u6216 plugins\/\/lib \u4e0b\u3002\u5982\u679c\u63d2\u4ef6\u662f\u7b2c\u4e09\u65b9\u6216\u81ea\u5df1\u7684\uff0c\u90a3\u4e48\u9700\u8981\u5148\u8fd0\u884c\u4e00\u6b21 sandbox\uff08\u5176\u5b9e\u6211\u4eec\u5728\u8fd0\u884c\u8c03\u8bd5\u63d2\u4ef6\u7684\u65f6\u5019\u5c31\u662f\u5728\u8fd0\u884csandbox\uff09\u5e76\u4ece\u672c\u5730\u6216\u63d2\u4ef6\u4ed3\u5e93\u5b89\u88c5\u4f9d\u8d56\u63d2\u4ef6\u3002\u5b89\u88c5\u597d\u540e\uff0c\u63d2\u4ef6\u5305\u4f1a\u653e\u5728 sandbox \u76ee\u5f55\u4e0b\u7684 config\/plugins\/ \u6216 config\/plugins\/\/lib\uff0c\u67e5\u770b sandbox \u76ee\u5f55\uff1a\u6253\u5f00 IntelliJ Platform SDK \u914d\u7f6e\u9875\u9762\uff0c\u5176\u4e2d Sandbox Home \u5c31\u662f\u5176\u76ee\u5f55\u3002<\/li>\n<li>\u5c06\u63d2\u4ef6\u5305\u6dfb\u52a0\u5230 SDK \u7684 classpath \u4e2d\u5bfc\u822a\u5230 File | Project Structure | SDKs\uff0c\u9009\u62e9\u63d2\u4ef6\u4f7f\u7528\u7684 IntelliJ Platform SDK\uff0c\u70b9\u51fb\u53f3\u4fa7 + \u53f7\uff0c\u5728\u5f39\u51fa\u7684\u6587\u4ef6\u9009\u62e9\u6846\u4e2d\u9009\u62e9\u8981\u4f9d\u8d56\u7684\u63d2\u4ef6\u5305\uff0c\u70b9\u51fb OK\u3002<\/li>\n<\/ol>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943807\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u914d\u7f6e plugin.xml\u5728 plugin.xml \u7684 \u90e8\u5206\u6dfb\u52a0\u6240\u4f9d\u8d56\u63d2\u4ef6\u7684id\u3002<\/p>\n<pre><code>\u00a0org.jetbrains.kotlin\n\n<\/code><\/pre>\n<p>plugin id \u53ef\u4ee5\u4ece\u63d2\u4ef6\u5305\u7684 plugin.xml \u6587\u4ef6\u67e5\u770b\u3002<\/p>\n<h2>\u5341\u3001GUI \u4ecb\u7ecd<\/h2>\n<p>GUI \u662f IntelliJ IDEA \u63d0\u4f9b\u7684\u4e00\u4e2a\u81ea\u52a8\u751f\u6210 java \u5e03\u5c40\u4ee3\u7801\u7684\u5de5\u5177\uff0c\u5b83\u4f7f\u7528 JDK \u4e2d\u7684 Swing \u63a7\u4ef6\u6765\u5b9e\u73b0 UI \u754c\u9762\u3002<\/p>\n<p>\u4f7f\u7528\u6b65\u9aa4\uff1a<\/p>\n<h3>1.\u914d\u7f6e<\/h3>\n<p>\u914d\u7f6e GUI\u9996\u5148\u6253\u5f00 Settings \u5bf9\u8bdd\u6846\uff0c\u9009\u62e9 Editor | GUI Designer\uff0c\u5982\u56fe\uff0c\u5728 Generate GUI into: \u6709\u4e24\u4e2a\u9009\u9879\uff0c\u751f\u6210 class \u6587\u4ef6\u6216 java \u4ee3\u7801\uff0c\u6211\u4eec\u9009\u62e9\u751f\u6210 java \u4ee3\u7801\uff0c\u56e0\u4e3a\u5efa\u597d\u5e03\u5c40\u540e\u53ef\u80fd\u9700\u8981\u4fee\u6539\u4ee3\u7801\u3002\u5176\u4ed6\u9ed8\u8ba4\u5373\u53ef\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943808\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>2.\u521b\u5efa form<\/h3>\n<p>\u521b\u5efa form \u6587\u4ef6form \u6587\u4ef6\u7528\u4e8e\u8bb0\u5f55\u754c\u9762\u5e03\u5c40\u3002\u5728\u76f8\u5e94\u7684 package \u4e0a\u53f3\u952e\uff0c\u9009\u62e9 New | GUI Form\uff0c\u5982\u56fe\uff0c\u8f93\u5165 form \u6587\u4ef6\u540d\uff0c\u4e00\u822c\u4e0e java \u6587\u4ef6\u540d\u76f8\u540c\uff0c\u70b9\u51fb OK \u521b\u5efa form \u4e0e java \u6587\u4ef6\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943809\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>3.\u9762\u677f\u4ecb\u7ecd<\/h3>\n<p>\u7f16\u8f91\u754c\u9762\u6253\u5f00 form \u6587\u4ef6\uff0c\u5982\u56fe\uff0c\u901a\u8fc7\u62d6\u62fd\u63a7\u4ef6\u6765\u642d\u5efa\u5e03\u5c40\u3002\u6bcf\u4e2aform\u6587\u4ef6\u5e03\u5c40\u7684 root \u63a7\u4ef6\u90fd\u662f\u4e00\u4e2a JPanel,\u53ef\u5c06\u8be5 root \u5bf9\u8c61\u4f20\u7ed9\u9700\u8981\u8be5\u5e03\u5c40\u7684\u7c7b\u3002\u6ce8\u610f\uff1a\u5de6\u4e0b\u89d2\u7684\u5c5e\u6027\u9762\u677f\uff0c\u53ea\u6709\u5f53\u586b\u5199\u4e86 field name \u5c5e\u6027\u65f6\u8be5\u63a7\u4ef6\u7684\u5bf9\u8c61\u624d\u4f1a\u88ab\u5f53\u6210\u6210\u5458\u53d8\u91cf\uff0c\u5426\u5219\u4e3a\u5c40\u90e8\u53d8\u91cf\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943810\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>4.\u6784\u5efa<\/h3>\n<p>\u751f\u6210 java \u4ee3\u7801\u642d\u5efa\u597d\u5e03\u5c40\u540e\uff0c\u70b9\u51fb build<\/p>\n<p>\u7f16\u8bd1\u6309\u94ae\uff0c\u5373\u53ef\u751f\u6210 java \u7684\u6e90\u7801\u6587\u4ef6\u3002<\/p>\n<p>GUI \u751f\u6210\u7684\u65b9\u6cd5\u540d\u524d\u540e\u90fd\u6709\u4e09\u4e2a $\u6807\u8bc6\uff0c\u5f53\u518d\u6b21\u4fee\u6539\u5e03\u5c40\u65f6\uff0cGUI \u53ea\u4f1a\u4fee\u6539$ \u6807\u8bc6\u7684\u65b9\u6cd5\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943811\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h2>\u5341\u4e00\u3001\u6e90\u7801\u5206\u6790SmartConverter<\/h2>\n<p>SmartConverter &#8212; POJO Object Converter<\/p>\n<p>\u9879\u76ee\u5730\u5740\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=FCAQlL0PDfT%2F7ql7R09u%2Bg%3D%3D.jaD3KMw9B8hWUsBDGiKd9za7MX4wM9LGtgUclaT2lFxrHW3DY7%2BXVHDA8otHRmw%2F\" rel=\"nofollow\">https:\/\/github.com\/zitiger\/smartconverter<\/a><\/p>\n<h3>1\u3001\u9879\u76ee\u80cc\u666f<\/h3>\n<p>\u5728\u5206\u5c42\u5f00\u53d1\u4e2d\uff0c\u6211\u4eec\u603b\u662f\u9762\u4e34\u7740\u5404\u79cdPOJO\uff08DTO,DO,JO,VO\uff09\u5bf9\u8c61\u4e4b\u95f4\u7684\u76f8\u4e92\u8f6c\u6362\u3002\u5f53\u5bf9\u8c61\u6bd4\u8f83\u590d\u6742\u65f6\uff0c\u7f16\u5199\u8f6c\u6362\u4ee3\u7801\u8017\u65f6\u8f83\u591a\uff0c\u4e14\u975e\u5e38\u5bb9\u6613\u51fa\u9519\u3002\u4ee5\u81f3\u4e8e\u53ef\u80fd\u4f1a\u51fa\u73b0\u5199\u4e00\u5929\u4ee3\u7801\uff0c\u534a\u5929\u5728\u5199\u5404\u79cdconvert\u7684\u56e7\u5883\u3002<\/p>\n<p>\u4e3a\u4e86\u5b9e\u73b0\u81ea\u52a8\u8f6c\u6362\uff0c\u51fa\u73b0\u4e86BeanUtil\u548cModelMapper\u7b49\u89e3\u51b3\u65b9\u6848\u3002\u8fd9\u4e9b\u65b9\u6848\uff0c\u5728\u5c11\u91cf\u5bf9\u8c61\u8f6c\u6362\u65f6\uff0c\u6027\u80fd\u635f\u8017\u53ef\u4ee5\u5ffd\u7565\uff0c\u4f46\u662f\u5f53\u8f6c\u6362\u6570\u91cf\u8fbe\u5230\u4e00\u5b9a\u91cf\u7ea7\u65f6\uff0c\u8fd9\u79cd\u635f\u8017\u4f1a\u5bf9\u6027\u80fd\u4ea7\u751f\u5f71\u54cd\u3002<\/p>\n<p>\u672c\u63d2\u4ef6\u53ef\u4ee5\u81ea\u52a8\u751f\u6210POJO\u4e4b\u95f4\u7684\u8f6c\u6362\u4ee3\u7801\uff0c\u7701\u53bb\u624b\u5de5\u8f6c\u6362\u7684\u9ebb\u70e6\uff0c\u4e5f\u4e0d\u4f1a\u635f\u5931\u6027\u80fd\u3002<\/p>\n<h3>2\u3001\u5b89\u88c5<\/h3>\n<p>\u4e0b\u8f7dSmartConverter.zip\uff0c\u5e76\u5728Intellij Idea\u4e2d\u5b89\u88c5\uff1b<\/p>\n<h3>3\u3001\u56db\u4e2a\u8f6c\u6362\u51fd\u6570<\/h3>\n<ol>\n<li>\u628a\u5149\u6807\u653e\u5230\u51fd\u6570\u4e2d\uff0c\u4e0d\u80fd\u662f\u51fd\u6570\u5185.<\/li>\n<li>\u5149\u6807\u79fb\u52a8\u5230\u51fd\u6570\u4f53\u5185\uff0c\u6309\u4e0b\u2318+N\uff0c\u5728\u5f39\u51fa\u7684Generate\u83dc\u5355\u4e2d\u9009\u62e9Smart Converter;<\/li>\n<li>\u63d2\u4ef6\u81ea\u52a8\u751f\u6210\u4e00\u4e0b\u56db\u4e2a\u8f6c\u6362\u51fd\u6570<\/li>\n<\/ol>\n<ul>\n<li>A -&gt; B<\/li>\n<li>B -&gt; A<\/li>\n<li>List<a href=\"https:\/\/link.segmentfault.com\/?enc=SbcWfTyHwzaScVeiG4rq5g%3D%3D.LSvNTqK3LPggTrs8Zv%2BN08lhpeXaqSGtCGoRmXzEiKixY6k%2FkugepZvu%2F0ahUcdFy%2BZ%2FFSbnRKtGuifWfmHbHUUMT4gwe8PH0qDB03%2BZBZYqFjgKojVGMw7bAKtlwlvb%2FmtpLL3O4mOmJaHO4N%2BfHLJfEfVaDBUZ%2BhIVQ%2Fch2yxOX7xMMXCEjyMXOM0XkRzaosAkrUyDT%2FZhQ%2Bo4jZtlZKHr8DELlOdhWCe5u%2FEPNZPoaOXT%2FVQl7L50tSgZMijoD0S4ooIloZ87xtzNhAUkPTjnUhdWdBm540rGQWvngsydMOo0rI6qPJzTll91HUWL6AxerbRnXy9WglK8n7lsFQ%3D%3D\" rel=\"nofollow\">-&gt; List<\/a><\/li>\n<li>List**-&gt; List**<\/li>\n<\/ul>\n<h3>4\u3001\u5355\u4e2a\u6293\u6362\u51fd\u6570<\/h3>\n<ol>\n<li>\n<p>\u5728\u7f16\u8f91\u5668\u4e2d\uff0c\u786e\u5b9a\u8fd4\u56de\u503c\u548c\u53c2\u6570\uff0c\u5b8c\u6210\u7a7a\u8f6c\u6362\u51fd\u6570;<\/p>\n<pre><code> public static List&lt;UserJO&gt; toDTOList(List&lt;UserDTO&gt; userDTOList) {\n\n }\n\n<\/code><\/pre>\n<\/li>\n<li>\u5149\u6807\u79fb\u52a8\u5230\u51fd\u6570\u4f53\u5185\uff0c\u6309\u4e0b\u2318+N\uff0c\u5728\u5f39\u51fa\u7684Generate\u83dc\u5355\u4e2d\u9009\u62e9Smart Converter;<\/li>\n<li>\u63d2\u4ef6\u6839\u636e\u5165\u53c2\u548c\u51fa\u53c2\u63a8\u65ad\u51fa\u9700\u8981\u8f6c\u6362\u7684POJO\u3002<\/li>\n<\/ol>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943812\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>5\u3001\u63d2\u4ef6\u7279\u8272<\/h3>\n<p>\u63d2\u4ef6\u81ea\u52a8\u4ece\u8f6c\u6362\u51fd\u6570\u7684\u53c2\u6570\u548c\u8fd4\u56de\u503c\u63a8\u65ad\u51fa\u8f6c\u6362POJO\uff1b<\/p>\n<p>\u652f\u6301List\u4e4b\u95f4\u7684\u8f6c\u6362\u3002<\/p>\n<p>\u5982\u679c\u5b58\u5728\u5355\u4e2a\u8f6c\u6362\u7684\u51fd\u6570\uff0c\u5219\u76f4\u63a5\u4f7f\u7528<\/p>\n<p>\u5982\u679c\u4e0d\u5b58\u5728\u5355\u4e2a\u8f6c\u6362\u7684\u51fd\u6570\uff0c\u521b\u5efa\u5355\u4e2a\u8f6c\u6362\u51fd\u6570<\/p>\n<p>\u652f\u6301\u5d4c\u5957\u8f6c\u6362<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943813\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h3>6\u3001\u6e90\u7801\u89e3\u8bfb<\/h3>\n<h4>6.1.\u5982\u4f55\u5c06ConvertGeneratorAction \u6dfb\u52a0\u5230\u83dc\u5355<\/h4>\n<p>\u56e0\u4e3a\u4f7f\u7528SmartConvert\u662f\u4f7f\u7528alt+insert\u5f39\u51fa\u6216\u8005\u53f3\u952e\u70b9\u51fbGenerate\u663e\u793aSmartConvertAction,\u6240\u4ee5\u6839\u636e\u524d\u6587\u7684\u6dfb\u52a0\u4f4d\u7f6e\u4e0d\u96be\u63a8\u65ad\u6dfb\u52a0\u5728\u5f39\u51fa\u83dc\u5355EditorPopupMenu\u4e0b\uff0c\u8fd9\u4e2a\u65f6\u5019\u6211\u4eec\u53ef\u4ee5\u4ece\u4e24\u4e2a\u65b9\u5411\u627e\u4ed6\u6dfb\u52a0\u7684\u4f4d\u7f6e\u3002<\/p>\n<p>\u9996\u5148\u4ece\u9879\u76ee\u7684\u914d\u7f6e\u6587\u4ef6\u8fdb\u5165\u627e\u5230plugin.xml\u4e0b\u914d\u7f6e\u7684action\u3002\u7531\u6b64\u4e0d\u96be\u770b\u51fa\u5b83\u5b9e\u9645\u662f\u6dfb\u52a0\u5728\u4e86GenerateGroup\u8fd9\u4e2a\u7ec4\u4e0a\u7684<\/p>\n<pre><code> &lt;actions&gt;\n        &lt;group id=&quot;com.zitiger.plugin.converter.generate.group&quot; popup=&quot;true&quot;&gt;\n            &lt;separator\/&gt;\n            &lt;!-- Add your actions here --&gt;\n            &lt;action id=&quot;com.zitiger.plugin.converter.action.generator&quot; class=&quot;com.zitiger.plugin.converter.action.ConvertGeneratorAction&quot;\n                    text=&quot;Smart Converter&quot; description=&quot;Smart Converter&quot;&gt;\n                &lt;keyboard-shortcut keymap=&quot;$default&quot; first-keystroke=&quot;shift meta N&quot;\/&gt;\n            &lt;\/action&gt;\n            &lt;add-to-group group-id=&quot;GenerateGroup&quot; anchor=&quot;last&quot;\/&gt;\n        &lt;\/group&gt;\n    &lt;\/actions&gt;\n\n<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943814\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u8fd9\u4e2a\u65f6\u5019\u6211\u4eec\u4e0d\u96be\u770b\u51fa\u5e76\u6ca1\u6709\u5730\u65b9\u5f15\u7528\u8fd9\u4e2a\u7ec4\uff0c\u8fd9\u4e2a\u65f6\u5019\u6211\u4eec\u4e0d\u9632\u4ece\u4f7f\u7528\u7684\u5730\u65b9\u5165\u624b\uff0c\u6211\u4eec\u662f\u53f3\u952e\u70b9\u51fbGenerate\u6216\u8005alt+insert\u5f39\u51fa\u7684EditorLangPopupMenu\u4e0b\u7684Generate\u7684\u7ec4\u3002\u8fd9\u4e2a\u65f6\u5019\u6211\u4eec\u53bb\u5168\u5c40\u641c\u7d22EditorPopupMenu<\/p>\n<p>\u53d1\u73b0\u8fd9\u91cc\u6709\u4e00\u4e2a\u6dfb\u52a0\u5230\u53f3\u952e\u83dc\u5355\u4e0b\u7684<\/p>\n<pre><code> &lt;group id=&quot;EditorLangPopupMenu&quot;&gt;\n      &lt;separator\/&gt;\n      &lt;group id=&quot;EditorPopupMenu.GoTo&quot; popup=&quot;true&quot;&gt;\n        &lt;reference ref=&quot;ShowNavBar&quot;\/&gt;\n        &lt;reference ref=&quot;GotoDeclaration&quot;\/&gt;\n        &lt;reference ref=&quot;GotoImplementation&quot;\/&gt;\n        &lt;reference ref=&quot;GotoTypeDeclaration&quot;\/&gt;\n        &lt;reference ref=&quot;GotoSuperMethod&quot;\/&gt;\n        &lt;reference ref=&quot;GotoTest&quot;\/&gt;\n      &lt;\/group&gt;\n      &lt;reference ref=&quot;Generate&quot;\/&gt;\n      &lt;separator\/&gt;\n      &lt;group id=&quot;EditorPopupMenu.Run&quot;&gt;\n        &lt;reference ref=&quot;RunContextPopupGroup&quot;\/&gt;\n      &lt;\/group&gt;\n      &lt;separator\/&gt;\n      &lt;reference ref=&quot;VersionControlsGroup&quot;\/&gt;\n      &lt;separator\/&gt;\n      &lt;reference ref=&quot;ExternalToolsGroup&quot;\/&gt;\n      &lt;add-to-group group-id=&quot;EditorPopupMenu&quot; relative-to-action=&quot;CompareClipboardWithSelection&quot; anchor=&quot;before&quot;\/&gt;\n    &lt;\/group&gt;\n\n<\/code><\/pre>\n<p>\u70b9\u51fb\u540e\u8df3\u8f6c\u7684\u662f<\/p>\n<pre><code> &lt;action id=&quot;Generate&quot; class=&quot;com.intellij.codeInsight.generation.actions.GenerateAction&quot;\/&gt;\n\n<\/code><\/pre>\n<p>GenerateAction\u7684\u70b9\u51fb\u65b9\u6cd5actionPerformed\u5185\u52a8\u6001\u751f\u6210\u4e86ActionGroup<\/p>\n<pre><code>JBPopupFactory.getInstance().createActionGroupPopup(CodeInsightBundle.message(&quot;generate.list.popup.title&quot;), wrapGroup(getGroup(),dataContext,project),dataContext,JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);\n\n<\/code><\/pre>\n<p>\u800cgetGroup() \u901a\u8fc7\u6307\u5b9agroupid \u83b7\u53d6\u5230GenerateGroup\u7684Action\u7ec4<\/p>\n<pre><code>return (DefaultActionGroup)ActionManager.getInstance().getAction(IdeActions.GROUP_GENERATE);\n\n<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943815\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h4>6.2.\u5982\u4f55\u5b9e\u73b0\u5b9e\u4f53\/~\/~\/~\/~\u8f6c\u6362<\/h4>\n<p>2.1Program Structure Interface (PSI)<\/p>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=6gLbKhu5by6KeawXL2uJXg%3D%3D.yUE8s6tYWsu0GYm4I2DEdwtJkfqwwDk30jwqtXORdXrpH8d%2B3vP%2BwVC17KFXDahTPGSCPiP2Lw0S1mqb7JJRPw%3D%3D\" rel=\"nofollow\">https:\/\/plugins.jetbrains.com\/docs\/intellij\/psi-files.html<\/a><\/p>\n<p>\u7a0b\u5e8f\u7ed3\u6784\u63a5\u53e3\uff0c\u901a\u5e38\u7b80\u79f0\u4e3a PSI\uff0c\u8d1f\u8d23\u89e3\u6790\u6587\u4ef6\u5e76\u521b\u5efa\u8bed\u6cd5\u548c\u8bed\u4e49\u4ee3\u7801\u6a21\u578b\uff0c\u4e3a\u5e73\u53f0\u7684\u4f17\u591a\u529f\u80fd\u63d0\u4f9b\u652f\u6301\u3002<\/p>\n<p>PSI\u6587\u4ef6\u662f\u7ed3\u6784\u7684\u6839\uff0c\u5c06\u6587\u4ef6\u5185\u5bb9\u8868\u793a\u4e3a\u7279\u5b9a\u7f16\u7a0b\u8bed\u8a00\u4e2d\u5143\u7d20\u7684\u5c42\u6b21\u7ed3\u6784<\/p>\n<p>PsiFile\u662f\u6240\u6709 PSI \u6587\u4ef6\u7684\u516c\u5171\u57fa\u7c7b\uff0c\u800c\u7279\u5b9a\u8bed\u8a00\u7684\u6587\u4ef6\u901a\u5e38\u7531\u5176\u5b50\u7c7b\u8868\u793a\u3002\u4f8b\u5982PsiJavaFile\u7c7b\u4ee3\u8868\u4e00\u4e2aJava\u6587\u4ef6\uff0c\u7c7bXmlFile\u4ee3\u8868\u4e00\u4e2aXML\u6587\u4ef6\u3002<\/p>\n<p>2.2\u67e5\u770b\u67d0\u4e00\u4e2a\u6587\u4ef6\u7684PSI\u7ed3\u6784<\/p>\n<p>\u53c2\u8003\u6587\u6863\uff1aPSI Viewer<\/p>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=jSVPfoIKsowboH71DINYpg%3D%3D.rkJbR7FAupIYHtS1tSre7hHW7sWK%2Foqvqtt2FI%2BD5vkvUMLPuach%2FAo%2BIsQu2WruUnqDt8daAlt0zhdSnsZ4Q9jlOEzkoWSf9%2F%2FEXihtQoJjqaXjkN4oOuP6FDCGBlkC2O733qrtn4FkB0c92m3Kqyxh70EynBGocGbJ9Dt%2FSGXfpm64FxtX3zjCQKU1evx0P%2FZJOHfC8lMxCXNCkJCO%2FFskzfdowZOduyOZJu0gHj%2F4xJXZWXQIy4%2FM7VIRLC8Ys%2BWw3hKsmtrejsyUVs7SGEJan5rOoZ%2Bvb0Ztneywc44%3D\" rel=\"nofollow\">https:\/\/www.jetbrains.com\/help\/idea\/psi-viewer.html?_ga=2.203&#8230;<\/a>.<\/p>\n<p>\u672a\u914d\u7f6e\u5f00\u542f\u67e5\u770bPIS\u7ed3\u6784\u65f6\u5982\u4e0b\u56fe<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943816\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u5f00\u542f\u67e5\u770bPIS\u7ed3\u6784 \u627e\u5230idea\u5b89\u88c5\u8def\u5f84\u4e0b\u7684bin\u76ee\u5f55\u4e0b\u7684idea.properties\u914d\u7f6e\u5982\u4e0b<\/p>\n<pre><code>idea.is.internal=true\n\n<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943817\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u5f00\u542f\u540e\u663e\u793a\u4e86View PSI Structure \u548cView PSI Structure of Current File<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943818\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u8fdb\u5165\u8981\u67e5\u770b\u7ed3\u6784\u7684\u6587\u4ef6\u540e\u70b9\u51fbView PSI Structure of Current File\/<br \/>\u67e5\u770b\u67d0\u4e00\u4e2a\u6587\u4ef6\u7684psi\u7ed3\u6784<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943819\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>2.3\u67e5\u770b\u63d2\u4ef6\u6e90\u7801<\/p>\n<p>\u8fdb\u5165ConvertGeneratorAction\u7684\u70b9\u51fb\u4e8b\u4ef6\u65b9\u6cd5\u4e0d\u96be\u770b\u5230\u5982\u4e0b\u7684\u6839\u636ePSI\u83b7\u53d6\u5f53\u524d\u7c7b\u548c\u65b9\u6cd5\u7684\u4ee3\u7801<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943820\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>2.4\u7ee7\u7eed\u8ddf\u8e2a\u751f\u6210\u65b9\u6cd5\u8f6c\u6362\u4ee3\u7801<\/p>\n<p>\u8fd9\u91cc\u4e3b\u8981\u662f\u6839\u636e\u8fd4\u56de\u7c7b\u578b\u83b7\u53d6\u5230\u4e86\u4e00\u4e2aMethodGenerator\u5e76\u6267\u884c\u5bf9\u5e94\u7684generateCode\u65b9\u6cd5<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943821\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>2.5MethodGenerator\u4e0b\u7684generateCode<\/p>\n<p>MethodGenerator\u4e0b\u7684generateCode\u4e3b\u8981\u83b7\u53d6\u4e86\u5f53\u524d\u65b9\u6cd5\u7684\u5165\u53c2fromClass\u4e0etoClass,\u5e76\u8fdb\u884c\u4e86\u5b57\u7b26\u4e32\u7684\u7ec4\u88c5\u548c\u751f\u6210\u4ee3\u7801\u5757\u3002<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943822\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\">\/<br \/>PsiCodeBlock codeBlock = elementFactory.\/<br \/>createCodeBlockFromText(&#8220;{&#8221; + String.join(&#8220;\/n&#8221;, statementList) + &#8220;}&#8221;, psiClass);\/<br \/>\u6e90\u7801\u5206\u6790\u5c31\u5230\u8fd9\u91cc\uff0c\u5982\u679c\u6709\u5174\u8da3\u7684\u540c\u5b66\u53ef\u4ee5\u81ea\u884c\u6df1\u5165\u5206\u6790\u5e76\u6b22\u8fce\u8865\u5145\u3002<\/p>\n<h2>\u5341\u4e8c\u3001\u6b66\u9b42\u878d\u5408<\/h2>\n<h3>1.\u5b9a\u4f4d<\/h3>\n<p>\u60f3\u7f16\u5199\u4e00\u4e2a\u4ec0\u4e48\u6837\u7684\u63d2\u4ef6(\u529f\u80fd)<\/p>\n<p>\u63d2\u4ef6\u8981\u5b9e\u73b0\u7684\u80fd\u529b\u662f\u4ec0\u4e48\uff0ceg\uff1a\u8fdb\u884c\u65b9\u6cd5\u5165\u53c2\u5feb\u901f\u8f6c\u4e3a\u51fa\u53c2\u3001\u83b7\u53d6\u9009\u62e9\u7684\u6587\u672c\u6dfb\u52a0\u4e3a\u7b14\u8bb0\u3001idea\u6fc0\u6d3b\u5f39\u51fa\u6846\u3001\u6570\u636e\u5e93Database&#8230;\u7b49\u3002<\/p>\n<h3>2.\u62c6\u89e3<\/h3>\n<p>\u5b9e\u73b0\u63d2\u4ef6\u9700\u8981\u5177\u5907\u54ea\u4e9b\u80fd\u529b(\u529f\u80fd\u62c6\u89e3)<\/p>\n<p>\u9700\u8981\u9875\u9762\u64cd\u4f5c\u4ea4\u4e92\u80fd\u529b(java swing)<\/p>\n<p>\u9700\u8981\u53d1\u9001http\u8bf7\u6c42\u80fd\u529b(\u6dfb\u52a0\u4f9d\u8d56\u7684\u80fd\u529b)<\/p>\n<p>\u9700\u8981\u6dfb\u52a0action\u7684\u80fd\u529b(\u63d2\u4ef6\u9700\u8981\u653e\u5728\u54ea\u91cc\uff0c\u63d2\u4ef6\u7684\u751f\u547d\u5468\u671f\u662f\u4ec0\u4e48\u7b49\u7ea7\u7684\u7b49\u3002)<\/p>\n<p>\u9700\u8981\u8bfb\u5199\u6587\u4ef6\u7684\u80fd\u91cc(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file),&#8221;utf-8&#8243;));)<\/p>\n<h3>3.\u843d\u5730<\/h3>\n<h4>3.1\u6dfb\u52a0\u4e00\u4e2aAction\u5230\u53f3\u952eEditorPopupMenu<\/h4>\n<p>\u521b\u5efa\u4e00\u4e2aaction\u5e76\u7ee7\u627fAnAction<\/p>\n<pre><code>package com.test.action;\n\nimport com.intellij.openapi.actionSystem.AnAction;\nimport com.intellij.openapi.actionSystem.AnActionEvent;\n\npublic class testAction extends AnAction {\n@Override\npublic void actionPerformed(AnActionEvent e) {\n    \/\/ TODO: insert action logic here\n    System.out.println(&quot;action\u70b9\u51fb\u89e6\u53d1\u65b9\u6cd5 = &quot; + e);\n}\n\n<\/code><\/pre>\n<p>}<\/p>\n<pre><code> &lt;actions&gt;\n    &lt;!-- Add your actions here --&gt;\n    &lt;action id=&quot;testAction&quot; class=&quot;com.test.action.testAction&quot; text=&quot;testAction&quot; description=&quot;testAction&quot;&gt;\n      &lt;add-to-group group-id=&quot;EditorPopupMenu&quot; anchor=&quot;before&quot; relative-to-action=&quot;ShowIntentionsGroup&quot;\/&gt;\n    &lt;\/action&gt;\n  &lt;\/actions&gt;\n\n<\/code><\/pre>\n<h4>3.2\u53d1\u8d77\u7f51\u7edc\u8bf7\u6c42\u83b7\u53d6\u6570\u636e<\/h4>\n<p>\u6dfb\u52a0spring\u76f8\u5173\u4f9d\u8d56\u5230gradle<\/p>\n<pre><code>dependencies {\n    testCompile group: 'junit', name: 'junit', version: '4.12'\n    \/\/ https:\/\/mvnrepository.com\/artifact\/org.springframework\/spring-web\n    implementation 'org.springframework:spring-web:5.1.13.RELEASE'\n    \/\/ https:\/\/mvnrepository.com\/artifact\/org.springframework\/spring-core\n    implementation 'org.springframework:spring-core:5.1.13.RELEASE'\n    \/\/ https:\/\/mvnrepository.com\/artifact\/org.springframework\/spring-beans\n    implementation 'org.springframework:spring-beans:5.1.13.RELEASE'\n}\n\n<\/code><\/pre>\n<p>\u4f7f\u7528spring-web\u4e0b\u7684RestTemplate\u521b\u5efa\u7f51\u7edc\u8bf7\u6c42\u5de5\u5177(\u4e5f\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528RestTemplate)<\/p>\n<pre><code>package com.test.http;\n\nimport org.springframework.http.HttpStatus;\nimport org.springframework.http.ResponseEntity;\nimport org.springframework.web.client.RestTemplate;\n\npublic class HttpUtil {\n    public static ResponseEntity&lt;Map&gt; get(String url){\n        RestTemplate restTemplate = new RestTemplate();\n        try {\n            ResponseEntity&lt;Map&gt; forEntity = new RestTemplate().getForEntity(url, Map.class);\n            return forEntity;\n        } catch (Exception e) {\n            e.printStackTrace();\n            return  null;\n        }\n    }\n}\n\n<\/code><\/pre>\n<p>\u5728\u9700\u7684\u5730\u65b9\u89e6\u53d1\u7f51\u7edc\u8bf7\u6c42\u83b7\u53d6\u6570\u636e<\/p>\n<pre><code>public class testAction extends AnAction {\n\n    @Override\n    public void actionPerformed(AnActionEvent e) {\n        \/\/ TODO: insert action logic here\n        System.out.println(&quot;action\u70b9\u51fb\u89e6\u53d1\u65b9\u6cd5 = &quot; + e);\n        ResponseEntity&lt;Map&gt; mapResponseEntity = HttpUtil.get(&quot;http:\/\/localhost:22200\/getPerson&quot;);\n        System.out.println(&quot;action\u70b9\u51fb\u89e6\u53d1\u7f51\u7edc\u8bf7\u6c42 = &quot; + mapResponseEntity.toString());\n    }\n}\n\n<\/code><\/pre>\n<p>\u89e6\u53d1\u9a8c\u8bc1<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943823\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h4>3.3\u56de\u663e\u5230idea\u754c\u9762<\/h4>\n<p>\u9996\u5148\u521b\u5efa\u4e00\u4e2a\u56de\u663e\u663e\u793a\u7684\u754c\u9762<\/p>\n<pre><code>package com.test.view;\n\nimport com.intellij.openapi.ui.DialogWrapper;\nimport org.jetbrains.annotations.Nullable;\n\nimport javax.swing.*;\nimport java.awt.*;\n\n\npublic class testDialog extends DialogWrapper {\n    JLabel label;\n\n    public testDialog(boolean canBeParent) {\n        super(canBeParent);\n        init();\/\/\u521d\u59cb\u5316dialog\n        setTitle(&quot;\u6807\u9898&quot;);\n    }\n\n    @Override\n    protected @Nullable JComponent createCenterPanel() {\n        \/*\u521b\u5efa\u4e00\u4e2a\u9762\u677f\uff0c\u8bbe\u7f6e\u5176\u5e03\u5c40\u4e3a\u8fb9\u754c\u5e03\u5c40*\/\n        JPanel centerPanel = new JPanel(new BorderLayout());\n        \/*\u521b\u5efa\u4e00\u4e2a\u6587\u5b57\u6807\u7b7e\uff0c\u6765\u627f\u8f7d\u5185\u5bb9*\/\n        String text = &quot;aaa11111\u6d4b\u8bd5\u56de\u663e\u5185\u5bb9&quot;;\n        label = new JLabel(text);\n        \/* \u8bbe\u7f6e\u9996\u5148\u5927\u5c0f*\/\n        label.setPreferredSize(new Dimension(100, 100));\n        \/*\u5c06\u6587\u5b57\u6807\u7b7e\u6dfb\u52a0\u7684\u9762\u677f\u7684\u6b63\u4e2d\u95f4*\/\n        centerPanel.add(label, BorderLayout.CENTER);\n        return centerPanel;\n    }\n\n    public void setLabelText(String text) {\n        label.setText(text);\n    }\n}\n\n<\/code><\/pre>\n<p>\u5728action\u5185\u89e6\u53d1\u8bf7\u6c42\u7f51\u7edc\u83b7\u53d6\u5185\u5bb9\u5e76\u8bbe\u7f6e\u5230\u663e\u793a\u7684\u9762\u677f\u4e0a\u3002<\/p>\n<pre><code>public class testAction extends AnAction {\n\n    @Override\n    public void actionPerformed(AnActionEvent e) {\n        \/\/ TODO: insert action logic here\n        System.out.println(&quot;action\u70b9\u51fb\u89e6\u53d1\u65b9\u6cd5 = &quot; + e);\n        ResponseEntity&lt;Map&gt; mapResponseEntity = HttpUtil.get(&quot;http:\/\/localhost:22200\/getPerson&quot;);\n        System.out.println(&quot;action\u70b9\u51fb\u89e6\u53d1\u7f51\u7edc\u8bf7\u6c42 = &quot; + mapResponseEntity.getBody());\n        testDialog testDialog=new testDialog(true);\n        testDialog.setLabelText(mapResponseEntity.getBody().toString());\n        testDialog.show();\n    }\n}\n\n<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943824\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h4>3.4\u4e71\u7801\u5904\u7406<\/h4>\n<p>\u50cf\u4e0a\u56fe\u7684\u6807\u9898\u7b49\u76f4\u63a5\u8d4b\u503c\u6c49\u5b57\u65f6\u4f1a\u6709\u4e71\u7801\uff0c\u91cd\u65b0\u7f16\u7801\u8fdb\u884c\u5904\u7406(\u8fd9\u79cd\u65b9\u5f0f\u7b80\u5355\u7684\u6c49\u5b57\u548c\u6c49\u5b57\u8f83\u5c11\u65f6\u53ef\u4ee5)<\/p>\n<pre><code> String encodeTitle = new String(&quot;\u6807\u9898&quot;.getBytes(&quot;gbk&quot;), &quot;UTF-8&quot;);\n title = new EditorTextField(encodeTitle);\n\n<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943825\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h4>3.5\u83b7\u53d6\u9009\u4e2d\u7684\u5185\u5bb9\u5e76\u56de\u663e<\/h4>\n<p>\u6211\u4eec\u4eceaction\u4e2d\u83b7\u53d6editor\u5bf9\u8c61\uff0c\u5728\u901a\u8fc7editor\u83b7\u53d6SelectionModel\uff0c\u5728\u83b7\u53d6\u9009\u4e2d\u7684\u6587\u672c\u3002<\/p>\n<p>\u5f39\u7a97\u63d0\u4f9b\u4e00\u4e2a\u91cd\u65b0\u8bbe\u7f6e\u9009\u62e9\u6587\u672c\u7684\u65b9\u6cd5 testDialog.setContent(selectedText);<\/p>\n<pre><code> @Override\n    public void actionPerformed(AnActionEvent e) {\n        \/\/ TODO: insert action logic here\n        testDialog testDialog = new testDialog(true);\n        \/\/\u83b7\u53d6\u5f53\u524d\u7f16\u8f91\u5668\u5bf9\u8c61\n        Editor editor = e.getRequiredData(CommonDataKeys.EDITOR);\n        \/\/\u83b7\u53d6\u9009\u62e9\u7684\u6570\u636e\u6a21\u578b\n        SelectionModel selectionModel = editor.getSelectionModel();\n        \/\/\u83b7\u53d6\u5f53\u524d\u9009\u62e9\u7684\u6587\u672c\n        String selectedText = selectionModel.getSelectedText();\n        System.out.println(selectedText);\n        testDialog.setContent(selectedText);\n        testDialog.show();\n    }\n\n<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943826\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u6d4b\u8bd5\u9009\u4e2d\u5185\u5bb9\u548c\u56de\u663e\u5185\u5bb9\u5982\u4e0b\u56fe<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943827\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h4>3.6\u6309\u94ae\u54cd\u5e94<\/h4>\n<pre><code>@Override\n    protected JComponent createSouthPanel() {\n        JPanel panel = new JPanel(new FlowLayout());\n        try {\n            String encodeTitle = new String(&quot;\u6807\u9898&quot;.getBytes(&quot;gbk&quot;), &quot;UTF-8&quot;);\n            JLabel title = new JLabel(encodeTitle);\n            String encodeBtnAdd = new String(&quot;\u6309\u94ae\u70b9\u51fb&quot;.getBytes(&quot;gbk&quot;), &quot;UTF-8&quot;);\n            JButton btnAdd = new JButton(encodeBtnAdd);\n            \/\/\u6309\u94ae\u70b9\u51fb\u4e8b\u4ef6\u5904\u7406\n            btnAdd.addActionListener(e -&gt; {\n                \/\/\u83b7\u53d6\u6807\u9898\n                String titleStr = title.getText();\n                \/\/\u83b7\u53d6\u5185\u5bb9\n                String contentStr = content.getText();\n                System.out.println(&quot;titleStr&quot; + &quot;:&quot; + titleStr);\n                System.out.println(&quot;contentStr&quot; + &quot;:&quot; + contentStr);\n                label.setText(getHttpText());\n            });\n            panel.add(title, BorderLayout.NORTH);\n            \/* \u8bbe\u7f6e\u9996\u5148\u5927\u5c0f*\/\n            btnAdd.setPreferredSize(new Dimension(200, 100));\n            panel.add(btnAdd, BorderLayout.CENTER);\n        } catch (UnsupportedEncodingException e) {\n            e.printStackTrace();\n        }\n        return panel;\n    }\n\n    private String getHttpText() {\n        ResponseEntity&lt;Map&gt; mapResponseEntity = HttpUtil.get(&quot;http:\/\/localhost:22200\/getPerson&quot;);\n        return mapResponseEntity.toString();\n    }\n\n<\/code><\/pre>\n<p>\u5982\u56fe\u6240\u793a\u70b9\u51fb\u6309\u94ae\u8bbf\u95ee\u672c\u5730http\u670d\u52a1\u83b7\u53d6\u6570\u636e\u540e\u56de\u663e<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943828\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h4>3.7\u83b7\u53d6\u63a7\u4ef6\u5185\u6570\u636e<\/h4>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943829\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h4>3.8\u4fdd\u5b58\u6570\u636e\u5230\u6587\u4ef6<\/h4>\n<p>\u53ef\u4ee5\u4f7f\u7528java\u672c\u8eab\u7684\u6d41\u8fdb\u884c\u8bfb\u5199\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u6a21\u677f\u5f15\u64ce\u8fdb\u884c,\u8fd9\u91cc\u4f7f\u7528freemarker\u6a21\u7248\u5f15\u64ce\/<br \/>3.8.1\u83b7\u53d6\u6309\u94ae\u70b9\u51fb\u4e8b\u4ef6\u540e\u5f39\u51fa\u76ee\u5f55\u9009\u62e9\u6846\u9009\u62e9\u8981\u4fdd\u5b58\u7684\u6587\u4ef6\u5939,\u9996\u5148\u9700\u8981\u6539\u9020\u5f39\u7a97\u7684\u6784\u9020\u5668\u4f20\u5165\u5f53\u524daction\u7684\u4e8b\u4ef6Event\uff0c\u4eceevent\u83b7\u53d6\u5f53\u524d\u7684\u5de5\u7a0b<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943830\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>3.8.2\u6309\u94ae\u70b9\u51fb\u4e8b\u4ef6\u521b\u5efa\u6587\u4ef6\u9009\u62e9\u5668<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943831\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u6709\u4eba\u4f1a\u6709\u7591\u95ee\uff0c\u4e3a\u4ec0\u4e48\u8fd9\u6837\u5c31\u5f39\u51fa\u4e86\u6587\u4ef6\u9009\u62e9\u5668,\u5176\u5b9e\u6700\u540e\u662f\u4e00\u4e2aFileChooser-&gt;FileChooserDialog<\/p>\n<pre><code>final FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, project, parent);\n    return chooser.choose(project, toSelect);\n\n<\/code><\/pre>\n<p>3.8.3\u5f15\u5165freemarker\u6a21\u7248\u5f15\u64ce\u4f9d\u8d56\u5e76\u8fdb\u884c\u6587\u4ef6\u521b\u5efa\u4fdd\u5b58<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943832\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u7ec4\u7ec7\u6570\u636e\u3001\u83b7\u53d6\u6a21\u7248\u3001\u521b\u5efa\u6587\u4ef6\u3001\u6267\u884c\u521b\u5efa\u6587\u4ef6<\/p>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943833\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<p>\u6a21\u7248\u4ee3\u7801\u521b\u5efa\u5e76\u83b7\u53d6\u4e0a\u56fe\u4e2d\u7684\u7ec4\u7ec7\u6570\u636emodel\u4e0b\u7684\u5185\u5bb9<\/p>\n<p>\u200b\u200b\u200b\u200b\u200b\u200b\u200b<img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943834\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h4>3.9\u901a\u77e5(\u5f53\u6709\u9519\u8bef\u6216\u6210\u529f\u662f\u5f39\u51fa\u901a\u77e5\u4e8b\u4ef6&#8211;IDEA\u7684Event Log)<\/h4>\n<pre><code>                       NotificationGroup notificationGroup = new NotificationGroup(&quot;testId&quot;, NotificationDisplayType.BALLOON, true);\n                        \/**\n                         * content :  \u901a\u77e5\u5185\u5bb9\n                         * type  \uff1a\u901a\u77e5\u7684\u7c7b\u578b\uff0cwarning,info,error\n                         *\/\n                        Notification notification = notificationGroup.createNotification(&quot;\u6d4b\u8bd5\u901a\u77e5\u4fdd\u5b58\u6210\u529f&quot;, MessageType.INFO);\n                        Notifications.Bus.notify(notification);\n\n<\/code><\/pre>\n<h4>3.10\u6269\u5c55\u67d0\u4e00\u4e2a\u6269\u5c55\u70b9<\/h4>\n<p>\u6dfb\u52a0\u4e00\u4e2a\u81ea\u5b9a\u4e49ToolWindow\/<br \/>3.10.1\u521b\u5efa\u4e00\u4e2atoolwindow<\/p>\n<pre><code>package com.test.view;\nimport com.intellij.openapi.wm.ToolWindow;\nimport javax.swing.*;\nimport java.text.SimpleDateFormat;\nimport java.util.Date;\n\npublic class MyToolWindow  {\n    private JButton hideButton;\n    private JLabel datetimeLabel;\n    private JPanel myToolWindowContent;\n    public MyToolWindow(ToolWindow toolWindow) {\n        init();\n        hideButton.addActionListener(e -&gt; toolWindow.hide(null));\n    }\n\n    private void init() {\n        datetimeLabel = new JLabel();\n        datetimeLabel.setText(new SimpleDateFormat(&quot;yyyy-MM-dd HH:mm:ss&quot;).format(new Date()));\n        hideButton = new JButton(&quot;\u53d6\u6d88&quot;);\n        myToolWindowContent = new JPanel();\n        myToolWindowContent.add(datetimeLabel);\n        myToolWindowContent.add(hideButton);\n    }\n    public JPanel getContent() {\n        return myToolWindowContent;\n    }\n}\n\n<\/code><\/pre>\n<p>3.10.2\u521b\u5efaToolWindowFactory\u7684\u5b9e\u73b0\u7c7b<\/p>\n<pre><code>package com.test.view;\nimport com.intellij.openapi.project.Project;\nimport com.intellij.openapi.wm.ToolWindow;\nimport com.intellij.openapi.wm.ToolWindowFactory;\nimport com.intellij.ui.content.Content;\nimport com.intellij.ui.content.ContentFactory;\nimport org.jetbrains.annotations.NotNull;\n\npublic class toolWindowExt implements ToolWindowFactory {\n    @Override\n    public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {\n        MyToolWindow myToolWindow = new MyToolWindow(toolWindow);\n        \/\/\u83b7\u53d6\u5185\u5bb9\u5de5\u5382\u7684\u5b9e\u4f8b\n        ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();\n        \/\/\u83b7\u53d6\u7528\u4e8etoolWindow\u663e\u793a\u7684\u5185\u5bb9\n        Content content = contentFactory.createContent(myToolWindow.getContent(), &quot;\u81ea\u5b9a\u4e49tool window&quot;, false);\n        \/\/\u7ed9toolWindow\u8bbe\u7f6e\u5185\u5bb9\n        toolWindow.getContentManager().addContent(content);\n    }\n}\n\n<\/code><\/pre>\n<p>3.10.3\u58f0\u660e\u6269\u5c55\u70b9\u5bf9\u5e94\u7684\u6269\u5c55<\/p>\n<pre><code>    &lt;extensions defaultExtensionNs=&quot;com.intellij&quot;&gt;\n        &lt;!-- Add your extensions here --&gt;\n        &lt;toolWindow id=&quot;\u6dfb\u52a0toolWindow&quot;\n                    secondary=&quot;false&quot;\n                    anchor=&quot;right&quot; factoryClass=&quot;com.test.view.toolWindowExt&quot;&gt;\n        &lt;\/toolWindow&gt;\n    &lt;\/extensions&gt;\n\n<\/code><\/pre>\n<p><img decoding=\"async\" referrerpolicy=\"no-referrer\" src=\"https:\/\/segmentfault.com\/img\/remote\/1460000043943835\" alt=\"image.png\" title=\"image.png\" loading=\"lazy\"><\/p>\n<h2>\u5341\u4e09\u3001\u53c2\u8003\u6587\u6863\uff1a<\/h2>\n<p>idea\u63d2\u4ef6\u5b98\u65b9\u6587\u6863\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=vC82V2A6cOXiuouvI04nvA%3D%3D.W14G0INvKL5OXj6KdoWPVLxwBTAZFSl2mpZxDt3erydMcnlyfECTPFQkPLSLx%2Bmgm%2FpZsdxylQtKiBqQt55T7Q%3D%3D\" rel=\"nofollow\">https:\/\/plugins.jetbrains.com\/docs\/intellij\/welcome.html<\/a><\/p>\n<p>gradle\u5b98\u65b9\u6587\u6863\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=Kye%2BB9%2B%2F920ohcte1S8W2A%3D%3D.hkY6nfuzYQSg%2Fe9kC%2BfRsSoM6uEbTCTwG8uaDMmYDf0it8Kn1rAjbBJf9sW0OaCjvrzn5007Z4%2B%2FFuBzoLXLEw%3D%3D\" rel=\"nofollow\">https:\/\/docs.gradle.org\/current\/userguide\/userguide.html<\/a><\/p>\n<p>freemarker\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=nOPwLauShGiiBlkaU0HDvQ%3D%3D.olzUAEBJDG5cV4r9GA4xw0GMD%2FTxE2ThkstBDV2%2F8RR5FGRL3Q8jKkfKKb729wEH\" rel=\"nofollow\">https:\/\/freemarker.apache.org\/docs\/<\/a><\/p>\n<p>\u4eac\u4e1c\u6280\u672f\uff1a<a href=\"https:\/\/link.segmentfault.com\/?enc=9XGqzcmBUQn4GRGaYdsNoQ%3D%3D.%2BXpcsSzG8YSyd84DbQtQJzFyqR1QqMp383BWtQAf4TuHO13OnDwnVGMjNUnbr%2F3PxXQLwBhQejfPdya%2BwLeAuA%3D%3D\" rel=\"nofollow\">https:\/\/cloud.tencent.com\/developer\/article\/1348741<\/a><\/p>\n<p>javaSwing:<a href=\"https:\/\/link.segmentfault.com\/?enc=ERO2uqcUECKZ%2BZASugL%2F2g%3D%3D.q5tY6QNkTqGZSXUisW2yKoBpsLKMjNm5EpuRVqIxUlH%2BdWetLyFjuraUwxsZ0%2FYx3YhjWjcAK%2B5Km6EV%2BUPZOV48fEuS5Z2LJRPNdu2t2YM%3D\" rel=\"nofollow\">https:\/\/docs.oracle.com\/javase\/tutorial\/uiswing\/components\/jc&#8230;<\/a><\/p>\n<p>sdk-code-samples:<a href=\"https:\/\/link.segmentfault.com\/?enc=y%2BH5jy2Ab%2BSLtLzLzFnLSg%3D%3D.fLO5n5ZZelMvgoDunEgdikc80xXylMkHndMmk0hAWlXtAusGgceBmV6OnUKOZBfEMZMtARGFR5cfK%2FW3bfIHmA%3D%3D\" rel=\"nofollow\">https:\/\/github.com\/JetBrains\/intellij-sdk-code-samples<\/a><\/p>\n<h2>\u5341\u56db\u3001\u5176\u4ed6\u63d2\u4ef6\u6587\u6863\u4f20\u9001\u95e8<\/h2>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=Odm4zAtu%2FnwkrnmT3LoCog%3D%3D.DJo%2BkEdS%2FaGHLDWqE4H3ozAZ3u7i8zRSTEQs69D89868iIEovX7W9jANZ29SA2CSZWKXkGXybuDwkBkZwvPuFAPVrTyEnThsxiUA9FPDhJyKFi6vHnj%2F%2BT%2BTP7ozQ7zqkX%2FIYSuT8JXLxoMEMJsvbanxMgB8aDKExW5S5x%2BZnlMK7vQftwJc1wSkTrvH1T7V\" rel=\"nofollow\">idea\u63d2\u4ef6\u5f00\u53d1\u7ecf\u9a8c\u603b\u7ed3\uff08\u4e00\uff09\uff1a\u73af\u5883\u642d\u5efa<\/a><\/p>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=M%2BWW9eN0Yi0gRR%2BvH6%2F4xA%3D%3D.6hPbRm4OvcxNz8OcJ0bL8BPkKqAs6xGRmfx1U85lbP0N7CB1uXi9CdlM66y9gCjlPF2332TXlKs4RWXZzcI0nB7bXnqjIJmuIbXtBzI3RhZEjTHgMgStPTldKb62yvSeFHAW3uCoAYbk4lwSVho8O6fC2F%2FMKOZvgY42xt8bJ1Y0qSnW6up0BO3sXzPcOQjlWgQc4QU2bEF4xJWXj30woA%3D%3D\" rel=\"nofollow\">IDEA\u63d2\u4ef6\u5f00\u53d1\u7b80\u660e\u6559\u7a0b<\/a><\/p>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=XBPVVkLFCGDJ4RkhkN%2FbbQ%3D%3D.EJFWn2CVzi08HL75k1Y3Ezu1%2F3EFXA1bIgBACkD2lkNYzGOTpEimF4rApJ16OuvU3v14KcJcHtnjvZl8hR7%2BQNZV8PA8FY7suPD3sXqRmSEXk1gujfcaNXA4mlOwTWJi96VIggx9R5Qz%2BJ4OgrjHxhypUKvDUSQBOu3bH54k%2Bq2oVdn2BOOeN9vuANl%2Bb%2B0VHptM%2BKMtYptvl%2Fn5jmViToXlQtVguVm8xEM%2BAlkWmm9HhaqxfoElAlN%2Bi4qgVRVs\" rel=\"nofollow\">\u3010IDEA\u63d2\u4ef6\u5f00\u53d1\u3011\u5feb\u901f\u5165\u95e8\u7cfb\u521701 \u5f00\u53d1\u4e00\u4e2a\u7b80\u5355\u7684Idea\u63d2\u4ef6<\/a><\/p>\n<p><a href=\"https:\/\/link.segmentfault.com\/?enc=Qfyykp0l9YWFduWc1CTLpA%3D%3D.rnRYxENNVIIL0scMUar%2BEmDXGYTsH5hmvmyFfG7a6OB%2F8KkxrJqpz3M8MnXVGAv8h%2BeuzS65oyJg8SoHbMMLLd9zjqYBGjG48t2MvPpFBLlCxJXne4B9eeVQIPRKjn2l4hSNE%2BWTTu%2BSt6nBgse%2FU4FeQl7CMA%2FV8Y6FqXl1tR8kJKO2OLmi8zJxiAxC6DV0BcXLTKhjpL%2FiNKSYrnBQlrSqrJZYBeRBvp%2BtvGBee9T6VACc2cxOYnIT4TcETRF7\" rel=\"nofollow\">IDEA Plugin \u63d2\u4ef6\u600e\u4e48\u5f00\u53d1\uff1f<\/a><\/p>\n<blockquote>\n<p>\u4f5c\u8005\uff1a\u4eac\u4e1c\u5065\u5eb7 \u9a6c\u4ec1\u559c<\/p>\n<p>\u6765\u6e90\uff1a\u4eac\u4e1c\u4e91\u5f00\u53d1\u8005\u793e\u533a<\/p>\n<\/blockquote>\n<p><a href=\"https:\/\/segmentfault.com\/a\/1190000043943775\">https:\/\/segmentfault.com\/a\/1190000043943775<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5199\u5728\u524d\u9762 \u5f88\u591aidea\u63d2\u4ef6\u6587\u6863\u66f4\u591a\u7684\u662f\u4ecb\u7ecd\u5982\u4f55\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684idea\u63d2\u4ef6\uff0c\u672c\u7bc7\u6587\u7ae0\u4ece\u5f00\u53d1\u73af\u5883\u3001demo\u3001\u751f\u6001\u7ec4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10008009","post","type-post","status-publish","format-standard","hentry","category-share"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008009","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10008009"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/10008009\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10008009"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10008009"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10008009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}