package Ġname . k ro pp . intellij . make file Ċ Ċ import Ġcom . intellij . execution . configuration . Environment Variables Component Ċ import Ġcom . intellij . icons . All Icons Ċ import Ġcom . intellij . openapi . application . Path Macros Ċ import Ġcom . intellij . openapi . file Chooser . FileChooser Descriptor Factory Ċ import Ġcom . intellij . openapi . options . Settings Editor Ċ import Ġcom . intellij . openapi . project . Project Ċ import Ġcom . intellij . openapi . ui .* Ċ import Ġcom . intellij . openapi . ui . popup . JB Popup Factory Ċ import Ġcom . intellij . openapi . vfs . Local FileSystem Ċ import Ġcom . intellij . psi . Psi Manager Ċ import Ġcom . intellij . ui .* Ċ import Ġcom . intellij . ui . components . fields . Expand able TextField Ċ import Ġcom . intellij . util . ui . Form Builder Ċ import Ġcom . intellij . util . ui . UI Util Ċ import Ġjava . awt . Border Layout Ċ import Ġjavax . swing . J Component Ċ import Ġjavax . swing . JPanel Ċ import Ġjavax . swing . event . Document Event Ċ Ċ class ĠMakefile Run Configuration Editor ( private Ġval Ġproject : ĠProject ) Ġ: ĠSettings Editor < Makefile Run Configuration >() Ġ{ ĊĠ Ġprivate Ġval Ġfilename Field Ġ= ĠTextField With Browse Button () ĊĠ Ġprivate Ġval Ġtarget Completion Provider Ġ= ĠTextField With Auto Completion . Strings Completion Provider ( emptyList (), ĠMakefile Target Icon ) ĊĠ Ġprivate Ġval Ġtarget Field Ġ= ĠTextField With Auto Completion < String >( project , Ġtarget Completion Provider , Ġtrue , Ġ"") ĊĠ Ġprivate Ġval Ġarguments Field Ġ= ĠExpand able TextField () ĊĠ Ġprivate Ġval Ġworking Directory Field Ġ= ĠTextField With Browse Button () ĊĠ Ġprivate Ġval Ġenvironment Vars Component Ġ= ĠEnvironment Variables Component () ĊĊĠ Ġprivate Ġval Ġpanel : ĠJPanel Ġby Ġlazy Ġ{ ĊĠĠĠ ĠForm Builder . create Form Builder () ĊĠĠĠĠĠĠĠ Ġ. set Align Label On Right ( false ) ĊĠĠĠĠĠĠĠ Ġ. setHorizontal Gap ( UI Util . DEFAULT _ HG AP ) ĊĠĠĠĠĠĠĠ Ġ. set Vertical Gap ( UI Util . DEFAULT _ VG AP ) ĊĠĠĠĠĠĠĠ Ġ. add Labeled Component ("& Makefile ", Ġfilename Field ) ĊĠĠĠĠĠĠĠ Ġ. add Labeled Component ("& Targets ", Ġtarget Field ) ĊĠĠĠĠĠĠĠ Ġ. addComponent ( Labeled Component . create ( arguments Field , Ġ"& Arguments ")) ĊĠĠĠĠĠĠĠ Ġ. add Labeled Component ("& Working ĠDirectory ", Ġcreate Component With Macro Browse ( working Directory Field )) ĊĠĠĠĠĠĠĠ Ġ. addComponent ( environment Vars Component ) ĊĠĠĠĠĠĠĠ Ġ. panel ĊĠ Ġ} ĊĊĠ Ġinit Ġ{ ĊĠĠĠ Ġfilename Field . add Browse Folder Listener (" Makefile ", Ġ" Makefile Ġpath ", Ġproject , ĠMakefile FileChooser Descriptor ()) ĊĠĠĠ Ġfilename Field . textField . document . add Document Listener ( object Ġ: ĠDocument Adapter () Ġ{ ĊĠĠĠĠĠ Ġoverride Ġfun Ġtext Changed ( event : ĠDocument Event ) Ġ{ ĊĠĠĠĠĠĠĠ Ġupdate Target Completion ( filename Field . text ) ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ}) ĊĠĠĠ Ġworking Directory Field . add Browse Folder Listener (" Choose ĠWorking ĠDirectory ", Ġ" Choose ĠWorking ĠDirectory ", Ġproject , ĠFile Chooser Descriptor Factory . create Single Folder Descriptor ()) ĊĠ Ġ} ĊĊĠ Ġfun Ġupdate Target Completion ( filename : ĠString ) Ġ{ ĊĠĠĠ Ġval Ġfile Ġ= ĠLocal FileSystem . getInstance (). find File By Path ( filename ) ĊĠĠĠ Ġif Ġ( file Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠ Ġval Ġpsi File Ġ= ĠPsi Manager . getInstance ( project ). find File ( file ) ĊĠĠĠĠĠ Ġif Ġ( psi File Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠ Ġtarget Completion Provider . set Items ( name . k ro pp . intellij . make file . find Targets ( psi File ). map Ġ{ Ġit . name Ġ}) ĊĠĠĠĠĠĠĠ Ġreturn ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠĠĠ Ġtarget Completion Provider . set Items ( emptyList ()) ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġcreate Editor () Ġ= Ġpanel ĊĊĠ Ġoverride Ġfun Ġapply Editor To ( configuration : ĠMakefile Run Configuration ) Ġ{ ĊĠĠĠ Ġconfiguration . filename Ġ= Ġfilename Field . text ĊĠĠĠ Ġconfiguration . target Ġ= Ġtarget Field . text ĊĠĠĠ Ġconfiguration . working Directory Ġ= Ġworking Directory Field . text ĊĠĠĠ Ġconfiguration . environment Variables Ġ= Ġenvironment Vars Component . env Data ĊĠĠĠ Ġconfiguration . arguments Ġ= Ġarguments Field . text ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġreset Editor From ( configuration : ĠMakefile Run Configuration ) Ġ{ ĊĠĠĠ Ġfilename Field . text Ġ= Ġconfiguration . filename ĊĠĠĠ Ġtarget Field . text Ġ= Ġconfiguration . target ĊĠĠĠ Ġworking Directory Field . text Ġ= Ġconfiguration . working Directory ĊĠĠĠ Ġenvironment Vars Component . env Data Ġ= Ġconfiguration . environment Variables ĊĠĠĠ Ġarguments Field . text Ġ= Ġconfiguration . arguments ĊĊĠĠĠ Ġupdate Target Completion ( configuration . filename ) ĊĠ Ġ} ĊĊĊĠ Ġ// Ġcopied Ġ& Ġconverted Ġto ĠKotlin Ġfrom Ġcom . intellij . execution . ui . Common Program Parameters Panel ĊĠ Ġprivate Ġfun Ġcreate Component With Macro Browse ( text Accessor : ĠTextField With Browse Button ): ĠJ Component Ġ{ ĊĠĠĠ Ġval Ġbutton Ġ= ĠFixed Size Button ( text Accessor ) ĊĠĠĠ Ġbutton . icon Ġ= ĠAll Icons . Actions . List Files ĊĠĠĠ Ġbutton . addActionListener Ġ{ ĊĠĠĠĠĠ ĠJ B Popup Factory . getInstance (). create Popup Chooser Builder ( Path Macros . getInstance (). user Macro Names . toList ()). setItem Ch osen Callback Ġ{ Ġitem : ĠString Ġ-> ĊĠĠĠĠĠĠĠ Ġtext Accessor . text Ġ= Ġ"$ $ item $" ĊĠĠĠĠĠ Ġ}. set Mov able ( false ). setResizable ( false ). create Popup (). show Under ne ath Of ( button ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġreturn ĠJPanel ( Border Layout ()). apply Ġ{ ĊĠĠĠĠĠ Ġadd ( text Accessor , ĠBorderLayout . CENTER ) ĊĠĠĠĠĠ Ġadd ( button , ĠBorderLayout . EAST ) ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ }