{"id":321747,"date":"2021-04-20T09:00:31","date_gmt":"2021-04-20T09:00:31","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=321747"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=321747","title":{"rendered":"\u0421\u043e\u0437\u0434\u0430\u0435\u043c plugin \u0434\u043b\u044f IDEA \u0434\u043b\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0439 \u0432 Spring"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p><em>Disclaimer: \u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0441\u044c \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u043e\u043c JetBrains (\u0430 \u0436\u0430\u043b\u044c), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0438 \u0441\u043b\u0443\u0436\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0438 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0446\u0435\u043b\u0435\u0439.<\/em><\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0427\u0430\u0441\u0442\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e Spring \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f @Transaction:<\/p>\n<ul>\n<li>\n<p>\u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043b\u0438 \u043c\u0435\u0441\u0442\u0435 \u043c\u044b \u0435\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043b\u0438 \u043e\u0431\u044a\u044f\u0432\u0438\u043b\u0441\u044f interceptor<\/p>\n<\/li>\n<li>\n<p>\u0438 \u0442.\u0434.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0430\u043c\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0432 debug \u0432 IDEA \u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u0438 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442<\/p>\n<pre><code class=\"java\">TransactionSynchronizationManager.isActualTransactionActive();<\/code><\/pre>\n<p>\u041d\u043e &#171;\u044f \u0436\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442&#187; \u0438 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0445\u043e\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0437\u0430\u043e\u0434\u043d\u043e \u043f\u043e\u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f plugin \u0434\u043b\u044f IDEA.<\/p>\n<p>\u0425\u043e\u0447\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u0442\u044c \u0441\u0435\u043c\u0430\u0444\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0430\u043a\u0442\u0438\u0432\u043d\u0430 \u043b\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0438\u043b\u0438 \u043d\u0435\u0442, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0440\u0435\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432\u043e\u0442 \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/936\/d20\/28a\/936d2028ae0f64bba89526c8e0341562.gif\" width=\"1233\" height=\"601\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0439 \u043f\u0440\u043e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/post\/532000\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<h2>\u0421 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f plugin?<\/h2>\n<p>\u041f\u0440\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 plugin \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/post\/546992\/\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u041f\u043e\u0432\u0442\u043e\u0440\u044e\u0441\u044c, \u0447\u0442\u043e \u0433\u043b\u0430\u0432\u043d\u044b\u043c\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043d\u044b\u043c\u0438 \u0442\u043e\u0447\u043a\u0430\u043c\u0438 \u0431\u0443\u0434\u0443\u0442:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/plugins.jetbrains.com\/docs\/intellij\/welcome.html\" rel=\"noopener noreferrer nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/JetBrains\/intellij-community\" rel=\"noopener noreferrer nofollow\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 IDEA<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/JetBrains\/intellij-platform-plugin-template\" rel=\"noopener noreferrer nofollow\">\u0428\u0430\u0431\u043b\u043e\u043d \u043f\u0440\u043e\u0435\u043a\u0442<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/JetBrains\/intellij-sdk-code-samples\" rel=\"noopener noreferrer nofollow\">\u041d\u0430\u0431\u043e\u0440 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432<\/a><\/p>\n<\/li>\n<\/ul>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d <a href=\"https:\/\/github.com\/pyltsin\/sniffer\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 action<\/h4>\n<p>\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e action \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/plugins.jetbrains.com\/docs\/intellij\/basic-action-system.html\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u041f\u043e\u0434 action, \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043a\u043d\u043e\u043f\u043a\u0430 \u0438\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0435\u043d\u044e.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u043e\u0432\u044b\u0439 action. \u0423 action \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 update \u0438 actionPerformed. <\/p>\n<ul>\n<li>\n<p>update &#8212; \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f idea \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (\u0432\u043a\u043b\u044e\u0447\u0435\u043d\/\u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d, \u0432\u0438\u0434\u0435\u043d\/\u043d\u0435 \u0432\u0438\u0434\u0435\u043d)<\/p>\n<\/li>\n<li>\n<p>actionPerformed &#8212; \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f idea \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f (\u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443).<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"java\">public class PopupDialogAction extends AnAction {    @Override   public void update(AnActionEvent e) {     \/\/ Using the event, evaluate the context, and enable or disable the action.   }    @Override   public void actionPerformed(@NotNull AnActionEvent e) {     \/\/ Using the event, implement an action. For example, create and show a dialog.   } }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 action, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 plugin.xml:<\/p>\n<pre><code class=\"xml\">&lt;actions&gt;   &lt;action id=\"TransactionStatusAction\"           class=\"com.github.pyltsin.sniffer.debugger.TransactionStatusAction\"           icon=\"SnifferIcons.RUNNING\"           text=\"Current Transaction Status\"&gt;     &lt;add-to-group group-id=\"XDebugger.ToolWindow.TopToolbar\" anchor=\"last\"\/&gt;   &lt;\/action&gt; &lt;\/actions&gt;<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u0430\u044f \u043a\u043d\u043e\u043f\u043a\u0430 \u043d\u0430 \u043f\u0430\u043d\u0435\u043b\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 debug-\u043e\u043a\u043d\u0435<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9d0\/4b7\/8aa\/9d04b78aaf7e1245d8f601ebe3500e2f.png\" width=\"1041\" height=\"237\"><figcaption><\/figcaption><\/figure>\n<h4>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 debug<\/h4>\n<p>IDEA \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0438 debug \u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u0430\u043c\u044f\u0442\u044c\u044e<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c23\/563\/65a\/c2356365a50dc9e935bbe101fb601c91.png\" width=\"489\" height=\"345\"><figcaption><\/figcaption><\/figure>\n<details class=\"spoiler\">\n<summary>\u0418 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0432\u0437\u044f\u0442\u0430 \u0438\u0437 <a href=\"https:\/\/twitter.com\/tagir_valeev\/status\/1360512507744550914\" rel=\"noopener noreferrer nofollow\">twitter \u0422\u0430\u0433\u0438\u0440\u0430 \u0412\u0430\u043b\u0435\u0435\u0432\u0430<\/a><\/p>\n<p>\u0412 Evaluate \u0434\u0430\u0436\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d \u0441\u0432\u043e\u0439 \u043c\u0438\u043d\u0438-\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 Java, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u0438\u043a\u043e\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0449\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a\u0438\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/836\/f8a\/bdf\/836f8abdf88d48012b40bcfee4ae7a56.png\" alt=\"\u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0438\u0437 \u043f\u043e\u0441\u0442\u0430 \u0422\u0430\u0433\u0438\u0440\u0430 \u0412\u0430\u043b\u0435\u0435\u0432\u0430 (https:\/\/twitter.com\/tagir_valeev\/status\/1360512527218728962)\" title=\"\u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0438\u0437 \u043f\u043e\u0441\u0442\u0430 \u0422\u0430\u0433\u0438\u0440\u0430 \u0412\u0430\u043b\u0435\u0435\u0432\u0430 (https:\/\/twitter.com\/tagir_valeev\/status\/1360512527218728962)\" width=\"680\" height=\"565\"><figcaption>\u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0438\u0437 \u043f\u043e\u0441\u0442\u0430 \u0422\u0430\u0433\u0438\u0440\u0430 \u0412\u0430\u043b\u0435\u0435\u0432\u0430 (https:\/\/twitter.com\/tagir_valeev\/status\/1360512527218728962)<\/figcaption><\/figure>\n<\/div>\n<\/details>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f API IDEA, \u043c\u044b \u043b\u0435\u0433\u043a\u043e \u0441\u043c\u043e\u0436\u0435\u043c \u0443\u0437\u043d\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u0430, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432:<\/p>\n<pre><code class=\"kotlin\">const val TRANSACTION_ACTIVE: String =     \"org.springframework.transaction.support.TransactionSynchronizationManager\"+   \t\".actualTransactionActive.get()==Boolean.TRUE\"<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 debug. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c <code>XDebugSession<\/code> \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0441 null<\/p>\n<pre><code class=\"kotlin\">override fun update(e: AnActionEvent) {   val presentation = e.presentation   val currentSession: XDebugSession? = getCurrentSession(e)   if (currentSession == null) {     setDisabled(presentation)     return   } }  private fun getCurrentSession(e: AnActionEvent): XDebugSession? {   val project = e.project   return if (project == null) null else    XDebuggerManager.getInstance(project).currentSession }<\/code><\/pre>\n<p>\u041c\u043d\u043e\u0433\u0438\u0435 \u0432\u0435\u0449\u0438 \u0432 idea \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d <a href=\"https:\/\/refactoring.guru\/ru\/design-patterns\/singleton\/java\/example\" rel=\"noopener noreferrer nofollow\">singleton<\/a> (\u0445\u043e\u0442\u044f \u044d\u0442\u043e \u0443\u0436\u0435 \u043f\u043e\u0447\u0442\u0438 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0430\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u043c &#8212; \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u043b\u044e\u0431\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>XDebuggerManager.getInstance<\/code>)<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e32\/f68\/880\/e32f68880907b679f3c24320f8a06be3.jpg\" alt=\"\u0415\u0432\u0433\u0435\u043d\u0438\u0439 \u0411\u043e\u0440\u0438\u0441\u043e\u0432 \u043d\u0435 \u043e\u0434\u043e\u0431\u0440\u044f\u0435\u0442 singleton \u043a\u0430\u043a pattern, \u043a\u043e\u0433\u0434\u0430 \u0435\u0441\u0442\u044c Spring\" title=\"\u0415\u0432\u0433\u0435\u043d\u0438\u0439 \u0411\u043e\u0440\u0438\u0441\u043e\u0432 \u043d\u0435 \u043e\u0434\u043e\u0431\u0440\u044f\u0435\u0442 singleton \u043a\u0430\u043a pattern, \u043a\u043e\u0433\u0434\u0430 \u0435\u0441\u0442\u044c Spring\" width=\"640\" height=\"480\"><figcaption>\u0415\u0432\u0433\u0435\u043d\u0438\u0439 \u0411\u043e\u0440\u0438\u0441\u043e\u0432 \u043d\u0435 \u043e\u0434\u043e\u0431\u0440\u044f\u0435\u0442 singleton \u043a\u0430\u043a pattern, \u043a\u043e\u0433\u0434\u0430 \u0435\u0441\u0442\u044c Spring<\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 Spring \u0438\u0437 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 Java. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c:<\/p>\n<pre><code class=\"kotlin\">public abstract class XDebuggerEvaluator {    public abstract void evaluate(@NotNull String expression,                                  @NotNull XEvaluationCallback callback,                                  @Nullable XSourcePosition expressionPosition); }<\/code><\/pre>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a<\/p>\n<pre><code class=\"kotlin\">val currentSourcePosition: XSourcePosition? = currentSession.currentStackFrame?. \t\t\t\t\t\t\t\t\t\t\t\t\tsourcePosition  currentSession.debugProcess.evaluator?.evaluate(   TRANSACTION_ACTIVE, object : XDebuggerEvaluator.XEvaluationCallback {     override fun errorOccurred(errorMessage: String) {       TODO(\"Not yet implemented\")     }      override fun evaluated(result: XValue) {       TODO(\"Not yet implemented\")     }   },   currentSourcePosition )<\/code><\/pre>\n<p>\u0412 XValue \u0442\u0435\u043f\u0435\u0440\u044c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0435\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c:<\/p>\n<pre><code class=\"kotlin\">(result as JavaValue).descriptor.value<\/code><\/pre>\n<p>\u041e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 &#8212; com.sun.jdi.Value<\/p>\n<details class=\"spoiler\">\n<summary>\u0427\u0430\u0441\u0442\u044c JavaDoc \u0434\u043b\u044f com.sun.jdi.Value<\/summary>\n<div class=\"spoiler__content\">\n<p>The mirror for a value in the target VM. This interface is the root of a value hierarchy encompassing primitive values and object values.<\/p>\n<\/div>\n<\/details>\n<p>\u041c\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 debug \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c API IDEA. <\/p>\n<h4>\u0420\u0430\u0431\u043e\u0447\u0430\u044f \u043f\u0430\u043d\u0435\u043b\u044c (Tool Window)<\/h4>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u0445 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0432 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u043f\u0430\u043d\u0435\u043b\u044c (Tool Window). \u041a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 <a href=\"https:\/\/plugins.jetbrains.com\/docs\/intellij\/tool-windows.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u0438 <a href=\"https:\/\/github.com\/JetBrains\/intellij-sdk-code-samples\/tree\/main\/tool_window\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440\u0430<\/a>.<\/p>\n<p>\u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u0432 plugin.xml \u043d\u043e\u0432\u043e\u0435 \u043e\u043a\u043d\u043e<\/p>\n<pre><code class=\"xml\">&lt;toolWindow id=\"TransactionView\" secondary=\"true\" icon=\"AllIcons.General.Modified\" anchor=\"right\" factoryClass=\"com.github.pyltsin.sniffer.ui.MyToolWindowFactory\"\/&gt; <\/code><\/pre>\n<pre><code class=\"java\">public class MyToolWindowFactory implements ToolWindowFactory {    public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {     MyToolWindow myToolWindow = new MyToolWindow(toolWindow, project);     ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();     Content content = contentFactory.createContent(myToolWindow.getContent(), \"\", false);      final ContentManager contentManager = toolWindow.getContentManager();     contentManager.addContent(content);   } } <\/code><\/pre>\n<p>\u0421\u0430\u043c\u043e \u043e\u043a\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0432\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/52c\/693\/c08\/52c693c08d55af14cf534fd2ff46d6aa.png\" width=\"967\" height=\"666\"><figcaption><\/figcaption><\/figure>\n<p>IDEA \u0441\u0430\u043c\u0430 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0434\u043b\u044f \u043d\u0430\u0441 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/707\/1f9\/e28\/7071f9e286f8b305fe1dba864ca9e578.png\" width=\"398\" height=\"229\"><figcaption><\/figcaption><\/figure>\n<p>\u0410 \u0434\u0430\u043b\u044c\u0448\u0435, \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u044f \u0441\u0442\u0430\u0440\u044b\u0439 \u0434\u043e\u0431\u0440\u044b\u0439 Swing, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0443 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 Listener.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/410\/f4e\/2f3\/410f4e2f36f3a39b8e0b9b9573903124.png\" alt=\"\u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0435\u0441\u044f \u043e\u043a\u043d\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (Tool Windows)\" title=\"\u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0435\u0441\u044f \u043e\u043a\u043d\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (Tool Windows)\" width=\"541\" height=\"241\"><figcaption>\u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0435\u0441\u044f \u043e\u043a\u043d\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (Tool Windows)<\/figcaption><\/figure>\n<h4>\u0421\u043f\u043e\u0441\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>\u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u043c\u0443 action. \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <code>actionPerformed<\/code>.<\/p>\n<p>\u041a\u0430\u043a \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043e\u0441\u0442\u0443\u0447\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u043a\u043d\u0430?<\/p>\n<p>\u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 &#8212; \u0441\u043d\u043e\u0432\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c:<\/p>\n<pre><code class=\"kotlin\">val toolWindow: ToolWindow? = ToolWindowManager.getInstance(project).getToolWindow(\"TransactionView\")<\/code><\/pre>\n<p>\u0418 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0442\u0443\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>IDEA \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0441\u043f\u043e\u0441\u043e\u0431 &#8212; Message Bus (\u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043b\u0443\u0447\u0448\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <a href=\"https:\/\/plugins.jetbrains.com\/docs\/intellij\/messaging-infrastructure.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>). \u041e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439:<\/p>\n<p>\u041e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441:<\/p>\n<pre><code class=\"java\">public interface ChangeActionNotifier {      Topic&lt;ChangeActionNotifier&gt; CHANGE_ACTION_TOPIC = Topic.create(\"custom name\", ChangeActionNotifier.class)      void beforeAction(Context context);     void afterAction(Context context); } <\/code><\/pre>\n<p>\u0412 \u043c\u0435\u0441\u0442\u0435, \u0433\u0434\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"java\">bus.connect().subscribe(ActionTopics.CHANGE_ACTION_TOPIC,  new ChangeActionNotifier() {         @Override         public void beforeAction(Context context) {             \/\/ Process 'before action' event.         }         @Override         public void afterAction(Context context) {             \/\/ Process 'after action' event.         } }); <\/code><\/pre>\n<p>\u0412 \u043c\u0435\u0441\u0442\u0435, \u0433\u0434\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"java\">ChangeActionNotifier publisher = myBus.syncPublisher(   ActionTopics.CHANGE_ACTION_TOPIC); publisher.beforeAction(context);<\/code><\/pre>\n<p>\u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u044b\u0442\u044c \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b\u043c \u0441 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u043e\u043b\u0433\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430 UI Thread (<a href=\"https:\/\/plugins.jetbrains.com\/docs\/intellij\/performance.html#avoiding-ui-freezes\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438<\/a>).<\/p>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u0438 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d <a href=\"https:\/\/github.com\/pyltsin\/sniffer\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<h4>\u041a\u0440\u0430\u0442\u043a\u0438\u0439 &#171;\u043a\u0430\u043a \u0431\u044b&#187; \u0432\u044b\u0432\u043e\u0434<\/h4>\n<p>IDEA \u043e\u0447\u0435\u043d\u044c \u0433\u0438\u0431\u043a\u0438\u0439 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438. IDEA \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0430\u0441\u0441\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0435\u0435 <a href=\"https:\/\/github.com\/JetBrains\/intellij-community\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u0434<\/a> \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432\u0441\u0435\u043c.<\/p>\n<h4>\u0421\u0441\u044b\u043b\u043a\u0438<\/h4>\n<ul>\n<li>\n<p><a href=\"https:\/\/plugins.jetbrains.com\/docs\/intellij\/welcome.html\" rel=\"noopener noreferrer nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/JetBrains\/intellij-community\" rel=\"noopener noreferrer nofollow\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 IDEA<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/JetBrains\/intellij-platform-plugin-template\" rel=\"noopener noreferrer nofollow\">\u0428\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/JetBrains\/intellij-sdk-code-samples\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/pyltsin\/sniffer\" rel=\"noopener noreferrer nofollow\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/552002\/\"> https:\/\/habr.com\/ru\/post\/552002\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p><em>Disclaimer: \u044f \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0441\u044c \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u043e\u043c JetBrains (\u0430 \u0436\u0430\u043b\u044c), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0435 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u0438 \u0441\u043b\u0443\u0436\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0438 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u0446\u0435\u043b\u0435\u0439.<\/em><\/p>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0427\u0430\u0441\u0442\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e Spring \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043b\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f @Transaction:<\/p>\n<ul>\n<li>\n<p>\u0432 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u043c \u043b\u0438 \u043c\u0435\u0441\u0442\u0435 \u043c\u044b \u0435\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043b\u0438 \u043e\u0431\u044a\u044f\u0432\u0438\u043b\u0441\u044f interceptor<\/p>\n<\/li>\n<li>\n<p>\u0438 \u0442.\u0434.<\/p>\n<\/li>\n<\/ul>\n<p>\u0421\u0430\u043c\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u043c \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u0431\u044b\u043b\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f \u0432 debug \u0432 IDEA \u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0435 \u0438 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442<\/p>\n<pre><code class=\"java\">TransactionSynchronizationManager.isActualTransactionActive();<\/code><\/pre>\n<p>\u041d\u043e &#171;\u044f \u0436\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442&#187; \u0438 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0445\u043e\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0437\u0430\u043e\u0434\u043d\u043e \u043f\u043e\u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f plugin \u0434\u043b\u044f IDEA.<\/p>\n<p>\u0425\u043e\u0447\u0435\u0442\u0441\u044f \u0438\u043c\u0435\u0442\u044c \u0441\u0435\u043c\u0430\u0444\u043e\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0430\u043a\u0442\u0438\u0432\u043d\u0430 \u043b\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0438\u043b\u0438 \u043d\u0435\u0442, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0440\u0435\u0437 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432\u043e\u0442 \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0439 \u043f\u0440\u043e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/post\/532000\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<h2>\u0421 \u0447\u0435\u0433\u043e \u043d\u0430\u0447\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f plugin?<\/h2>\n<p>\u041f\u0440\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 plugin \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/post\/546992\/\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>\u041f\u043e\u0432\u0442\u043e\u0440\u044e\u0441\u044c, \u0447\u0442\u043e \u0433\u043b\u0430\u0432\u043d\u044b\u043c\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043d\u044b\u043c\u0438 \u0442\u043e\u0447\u043a\u0430\u043c\u0438 \u0431\u0443\u0434\u0443\u0442:<\/p>\n<ul>\n<li>\n<p><a href=\"https:\/\/plugins.jetbrains.com\/docs\/intellij\/welcome.html\" rel=\"noopener noreferrer nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/JetBrains\/intellij-community\" rel=\"noopener noreferrer nofollow\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 IDEA<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/JetBrains\/intellij-platform-plugin-template\" rel=\"noopener noreferrer nofollow\">\u0428\u0430\u0431\u043b\u043e\u043d \u043f\u0440\u043e\u0435\u043a\u0442<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/JetBrains\/intellij-sdk-code-samples\" rel=\"noopener noreferrer nofollow\">\u041d\u0430\u0431\u043e\u0440 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432<\/a><\/p>\n<\/li>\n<\/ul>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h3>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d <a href=\"https:\/\/github.com\/pyltsin\/sniffer\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 action<\/h4>\n<p>\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e action \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/plugins.jetbrains.com\/docs\/intellij\/basic-action-system.html\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u041f\u043e\u0434 action, \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043a\u043d\u043e\u043f\u043a\u0430 \u0438\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043c\u0435\u043d\u044e.<\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043c \u043d\u043e\u0432\u044b\u0439 action. \u0423 action \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 update \u0438 actionPerformed. <\/p>\n<ul>\n<li>\n<p>update &#8212; \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f idea \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (\u0432\u043a\u043b\u044e\u0447\u0435\u043d\/\u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d, \u0432\u0438\u0434\u0435\u043d\/\u043d\u0435 \u0432\u0438\u0434\u0435\u043d)<\/p>\n<\/li>\n<li>\n<p>actionPerformed &#8212; \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f idea \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f (\u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443).<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"java\">public class PopupDialogAction extends AnAction {    @Override   public void update(AnActionEvent e) {     \/\/ Using the event, evaluate the context, and enable or disable the action.   }    @Override   public void actionPerformed(@NotNull AnActionEvent e) {     \/\/ Using the event, implement an action. For example, create and show a dialog.   } }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439 action, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 plugin.xml:<\/p>\n<pre><code class=\"xml\">&lt;actions&gt;   &lt;action id=\"TransactionStatusAction\"           class=\"com.github.pyltsin.sniffer.debugger.TransactionStatusAction\"           icon=\"SnifferIcons.RUNNING\"           text=\"Current Transaction Status\"&gt;     &lt;add-to-group group-id=\"XDebugger.ToolWindow.TopToolbar\" anchor=\"last\"\/&gt;   &lt;\/action&gt; &lt;\/actions&gt;<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u0430\u044f \u043a\u043d\u043e\u043f\u043a\u0430 \u043d\u0430 \u043f\u0430\u043d\u0435\u043b\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0432 debug-\u043e\u043a\u043d\u0435<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h4>\u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 debug<\/h4>\n<p>IDEA \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0438 debug \u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u0430\u043c\u044f\u0442\u044c\u044e<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<details class=\"spoiler\">\n<summary>\u0418 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e<\/summary>\n<div class=\"spoiler__content\">\n<p>\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0432\u0437\u044f\u0442\u0430 \u0438\u0437 <a href=\"https:\/\/twitter.com\/tagir_valeev\/status\/1360512507744550914\" rel=\"noopener noreferrer nofollow\">twitter \u0422\u0430\u0433\u0438\u0440\u0430 \u0412\u0430\u043b\u0435\u0435\u0432\u0430<\/a><\/p>\n<p>\u0412 Evaluate \u0434\u0430\u0436\u0435 \u0432\u0441\u0442\u0440\u043e\u0435\u043d \u0441\u0432\u043e\u0439 \u043c\u0438\u043d\u0438-\u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0430\u0442\u043e\u0440 Java, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u0440\u0438\u043a\u043e\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0449\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a\u0438\u0435:<\/p>\n<figure class=\"full-width\"><figcaption>\u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0438\u0437 \u043f\u043e\u0441\u0442\u0430 \u0422\u0430\u0433\u0438\u0440\u0430 \u0412\u0430\u043b\u0435\u0435\u0432\u0430 (https:\/\/twitter.com\/tagir_valeev\/status\/1360512527218728962)<\/figcaption><\/figure>\n<\/div>\n<\/details>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f API IDEA, \u043c\u044b \u043b\u0435\u0433\u043a\u043e \u0441\u043c\u043e\u0436\u0435\u043c \u0443\u0437\u043d\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f \u0430\u043a\u0442\u0438\u0432\u043d\u0430, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0432:<\/p>\n<pre><code class=\"kotlin\">const val TRANSACTION_ACTIVE: String =     \"org.springframework.transaction.support.TransactionSynchronizationManager\"+   \t\".actualTransactionActive.get()==Boolean.TRUE\"<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0431\u044b\u043b\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e, \u0435\u0441\u043b\u0438 \u043c\u044b \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 debug. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c <code>XDebugSession<\/code> \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0441 null<\/p>\n<pre><code class=\"kotlin\">override fun update(e: AnActionEvent) {   val presentation = e.presentation   val currentSession: XDebugSession? = getCurrentSession(e)   if (currentSession == null) {     setDisabled(presentation)     return   } }  private fun getCurrentSession(e: AnActionEvent): XDebugSession? {   val project = e.project   return if (project == null) null else    XDebuggerManager.getInstance(project).currentSession }<\/code><\/pre>\n<p>\u041c\u043d\u043e\u0433\u0438\u0435 \u0432\u0435\u0449\u0438 \u0432 idea \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u043f\u0430\u0442\u0442\u0435\u0440\u043d <a href=\"https:\/\/refactoring.guru\/ru\/design-patterns\/singleton\/java\/example\" rel=\"noopener noreferrer nofollow\">singleton<\/a> (\u0445\u043e\u0442\u044f \u044d\u0442\u043e \u0443\u0436\u0435 \u043f\u043e\u0447\u0442\u0438 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0430\u043d\u0442\u0438\u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u043c &#8212; \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e, \u0447\u0442\u043e \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u043b\u044e\u0431\u043e\u0433\u043e \u043c\u0435\u0441\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>XDebuggerManager.getInstance<\/code>)<\/p>\n<figure class=\"full-width\"><figcaption>\u0415\u0432\u0433\u0435\u043d\u0438\u0439 \u0411\u043e\u0440\u0438\u0441\u043e\u0432 \u043d\u0435 \u043e\u0434\u043e\u0431\u0440\u044f\u0435\u0442 singleton \u043a\u0430\u043a pattern, \u043a\u043e\u0433\u0434\u0430 \u0435\u0441\u0442\u044c Spring<\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 Spring \u0438\u0437 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0441\u0435\u0441\u0441\u0438\u0438 Java. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c:<\/p>\n<pre><code class=\"kotlin\">public abstract class XDebuggerEvaluator {    public abstract void evaluate(@NotNull String expression,                                  @NotNull XEvaluationCallback callback,                                  @Nullable XSourcePosition expressionPosition); }<\/code><\/pre>\n<p>\u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a<\/p>\n<pre><code class=\"kotlin\">val currentSourcePosition: XSourcePosition? = currentSession.currentStackFrame?. \t\t\t\t\t\t\t\t\t\t\t\t\tsourcePosition  currentSession.debugProcess.evaluator?.evaluate(   TRANSACTION_ACTIVE, object : XDebuggerEvaluator.XEvaluationCallback {     override fun errorOccurred(errorMessage: String) {       TODO(\"Not yet implemented\")     }      override fun evaluated(result: XValue) {       TODO(\"Not yet implemented\")     }   },   currentSourcePosition )<\/code><\/pre>\n<p>\u0412 XValue \u0442\u0435\u043f\u0435\u0440\u044c \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0435\u0433\u043e, \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c:<\/p>\n<pre><code class=\"kotlin\">(result as JavaValue).descriptor.value<\/code><\/pre>\n<p>\u041e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 &#8212; com.sun.jdi.Value<\/p>\n<details class=\"spoiler\">\n<summary>\u0427\u0430\u0441\u0442\u044c JavaDoc \u0434\u043b\u044f com.sun.jdi.Value<\/summary>\n<div class=\"spoiler__content\">\n<p>The mirror for a value in the target VM. This interface is the root of a value hierarchy encompassing primitive values and object values.<\/p>\n<\/div>\n<\/details>\n<p>\u041c\u044b \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 debug \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c API IDEA. <\/p>\n<h4>\u0420\u0430\u0431\u043e\u0447\u0430\u044f \u043f\u0430\u043d\u0435\u043b\u044c (Tool Window)<\/h4>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0438\u0445 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0432 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u043f\u0430\u043d\u0435\u043b\u044c (Tool Window). \u041a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 <a href=\"https:\/\/plugins.jetbrains.com\/docs\/intellij\/tool-windows.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a> \u0438 <a href=\"https:\/\/github.com\/JetBrains\/intellij-sdk-code-samples\/tree\/main\/tool_window\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u0438\u043c\u0435\u0440\u0430<\/a>.<\/p>\n<p>\u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u0432 plugin.xml \u043d\u043e\u0432\u043e\u0435 \u043e\u043a\u043d\u043e<\/p>\n<pre><code class=\"xml\">&lt;toolWindow id=\"TransactionView\" secondary=\"true\" icon=\"AllIcons.General.Modified\" anchor=\"right\" factoryClass=\"com.github.pyltsin.sniffer.ui.MyToolWindowFactory\"\/&gt; <\/code><\/pre>\n<pre><code class=\"java\">public class MyToolWindowFactory implements ToolWindowFactory {    public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {     MyToolWindow myToolWindow = new MyToolWindow(toolWindow, project);     ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();     Content content = contentFactory.createContent(myToolWindow.getContent(), \"\", false);      final ContentManager contentManager = toolWindow.getContentManager();     contentManager.addContent(content);   } } <\/code><\/pre>\n<p>\u0421\u0430\u043c\u043e \u043e\u043a\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0432\u043e \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u043e\u043c \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>IDEA \u0441\u0430\u043c\u0430 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0434\u043b\u044f \u043d\u0430\u0441 \u0437\u0430\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u043a\u043b\u0430\u0441\u0441\u0430:<\/p>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u0410 \u0434\u0430\u043b\u044c\u0448\u0435, \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u044f \u0441\u0442\u0430\u0440\u044b\u0439 \u0434\u043e\u0431\u0440\u044b\u0439 Swing, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043b\u043e\u0433\u0438\u043a\u0443 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 Listener.<\/p>\n<figure class=\"full-width\"><figcaption>\u041f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0435\u0441\u044f \u043e\u043a\u043d\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 (Tool Windows)<\/figcaption><\/figure>\n<h4>\u0421\u043f\u043e\u0441\u043e\u0431\u044b \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<p>\u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043d\u0430\u0448\u0435\u043c\u0443 action. \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043e\u0434 <code>actionPerformed<\/code>.<\/p>\n<p>\u041a\u0430\u043a \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 \u0434\u043e\u0441\u0442\u0443\u0447\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u043a\u043d\u0430?<\/p>\n<p>\u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 &#8212; \u0441\u043d\u043e\u0432\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c:<\/p>\n<pre><code class=\"kotlin\">val toolWindow: ToolWindow? = ToolWindowManager.getInstance(project).getToolWindow(\"TransactionView\")<\/code><\/pre>\n<p>\u0418 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0442\u0443\u0434\u0430 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>IDEA \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0441\u043f\u043e\u0441\u043e\u0431 &#8212; Message Bus (\u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043b\u0443\u0447\u0448\u0435 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <a href=\"https:\/\/plugins.jetbrains.com\/docs\/intellij\/messaging-infrastructure.html\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>). \u041e\u0434\u0438\u043d \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439:<\/p>\n<p>\u041e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441:<\/p>\n<pre><code class=\"java\">public interface ChangeActionNotifier {      Topic&lt;ChangeActionNotifier&gt; CHANGE_ACTION_TOPIC = Topic.create(\"custom name\", ChangeActionNotifier.class)      void beforeAction(Context context);     void afterAction(Context context); } <\/code><\/pre>\n<p>\u0412 \u043c\u0435\u0441\u0442\u0435, \u0433\u0434\u0435 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"java\">bus.connect().subscribe(ActionTopics.CHANGE_ACTION_TOPIC,  new ChangeActionNotifier() {         @Override         public void beforeAction(Context context) {             \/\/ Process 'before action' event.         }         @Override         public void afterAction(Context context) {             \/\/ Process 'after action' event.         } }); <\/code><\/pre>\n<p>\u0412 \u043c\u0435\u0441\u0442\u0435, \u0433\u0434\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"java\">ChangeActionNotifier publisher = myBus.syncPublisher(   ActionTopics.CHANGE_ACTION_TOPIC); publisher.beforeAction(context);<\/code><\/pre>\n<p>\u0412 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u044b\u0442\u044c \u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u044b\u043c \u0441 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0438 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u043e\u043b\u0433\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430 UI Thread (<a href=\"https:\/\/plugins.jetbrains.com\/docs\/intellij\/performance.html#avoiding-ui-freezes\" rel=\"noopener noreferrer nofollow\">\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438<\/a>).<\/p>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u0438 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u0433\u043e\u0441\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d <a href=\"https:\/\/github.com\/pyltsin\/sniffer\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<h4>\u041a\u0440\u0430\u0442\u043a\u0438\u0439 &#171;\u043a\u0430\u043a \u0431\u044b&#187; \u0432\u044b\u0432\u043e\u0434<\/h4>\n<p>IDEA \u043e\u0447\u0435\u043d\u044c \u0433\u0438\u0431\u043a\u0438\u0439 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u043c\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438. IDEA \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0430\u0441\u0441\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0441\u0435\u0431\u044f, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435 \u0435\u0435 <a href=\"https:\/\/github.com\/JetBrains\/intellij-community\" rel=\"noopener noreferrer nofollow\">\u043a\u043e\u0434<\/a> \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432\u0441\u0435\u043c.<\/p>\n<h4>\u0421\u0441\u044b\u043b\u043a\u0438<\/h4>\n<ul>\n<li>\n<p><a href=\"https:\/\/plugins.jetbrains.com\/docs\/intellij\/welcome.html\" rel=\"noopener noreferrer nofollow\">\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/JetBrains\/intellij-community\" rel=\"noopener noreferrer nofollow\">\u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 IDEA<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/JetBrains\/intellij-platform-plugin-template\" rel=\"noopener noreferrer nofollow\">\u0428\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/JetBrains\/intellij-sdk-code-samples\" rel=\"noopener noreferrer nofollow\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u0432<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/github.com\/pyltsin\/sniffer\" rel=\"noopener noreferrer nofollow\">\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/552002\/\"> https:\/\/habr.com\/ru\/post\/552002\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-321747","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/321747","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=321747"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/321747\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=321747"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=321747"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=321747"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}