package Ġcom . a em tools . diagnostics . error . handler Ċ Ċ import Ġcom . a em tools . diagnostics . error . handler . exception . Token Initialization Exception Ċ import Ġcom . a em tools . diagnostics . error . handler . model . Created GitHub Issue Ċ import Ġcom . a em tools . diagnostics . error . handler . provider . AccessToken Holder Ċ import Ġcom . a em tools . diagnostics . error . handler . provider . Issue Info Factory Ċ import Ġcom . a em tools . diagnostics . error . handler . provider . impl . Environment Info Provider Impl Ċ import Ġcom . a em tools . diagnostics . error . handler . provider . impl . GitHub AccessToken Holder Ċ import Ġcom . a em tools . diagnostics . error . handler . provider . impl . GitHub Issue Info Factory Ċ import Ġcom . google . gson . Gson Ċ import Ġcom . intellij . ide . DataManager Ċ import Ġcom . intellij . notification . Notification Ċ import Ġcom . intellij . notification . Notification Listener . URL _ OPEN ING _ LIST ENER Ċ import Ġcom . intellij . notification . Notification Type Ċ import Ġcom . intellij . notification . Notifications Ċ import Ġcom . intellij . openapi . action System . Common Data Keys Ċ import Ġcom . intellij . openapi . diagnostic . Error Report Submit ter Ċ import Ġcom . intellij . openapi . diagnostic . Ide a Logging Event Ċ import Ġcom . intellij . openapi . diagnostic . Submitted Report Info Ċ import Ġcom . intellij . openapi . progress . Progress Indicator Ċ import Ġcom . intellij . openapi . progress . Progress Manager Ċ import Ġcom . intellij . openapi . progress . Task Ċ import Ġcom . intellij . util . Consumer Ċ import Ġorg . apache . commons . lang 3 . StringUtils Ċ import Ġorg . apache . http . Http Entity Ċ import Ġorg . apache . http . HttpStatus Ċ import Ġorg . apache . http . client . methods . HttpPost Ċ import Ġorg . apache . http . entity . String Entity Ċ import Ġorg . apache . http . impl . client . HttpClient Builder Ċ import Ġorg . apache . http . message . Basic Header Ċ import Ġjava . awt . Component Ċ Ċ /** Ċ Ġ* Ġ@ author ĠDe us Bit Ċ Ġ*/ Ċ class ĠGitHub ErrorHandler Ġ: ĠError Report Submit ter () Ġ{ ĊĠ Ġval Ġconfig Ġ= ĠError Reporting Config () ĊĠ Ġval Ġgson Ġ= ĠGson () ĊĊĠ Ġoverride Ġfun Ġget Privacy Notice Text (): ĠString Ġ{ ĊĠĠĠ Ġreturn Ġ""" ĊĠĠĠĠĠ ĠPlease Ġprovide Ġa Ġbrief Ġdescription Ġto Ġexplain Ġhow Ġthe Ġerror Ġoccurred . ĠĊĠĠĠĠĠ ĠBy Ġsubmitting Ġthis Ġbug Ġreport Ġyou Ġare Ġagree ing Ġfor Ġthe Ġdisplayed Ġstack trace , ĠĊĠĠĠĠĠ ĠIDE Ġversion , ĠJava Ġversion , ĠJava Ġvendor , ĠOS Ġname / version / arch ĠĠĊĠĠĠĠĠ Ġto Ġbe Ġshared Ġwith Ġthe Ġdevelopers Ġon Ġour ĊĠĠĠĠĠ Ġ< a Ġhref =" https :// github . com /${ config . userId }/${ config . repo Name }"> Github </ a >. ĊĠĠĠ Ġ""" . trim Indent () ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġget Report Action Text (): ĠString Ġ{ ĊĠĠĠ Ġreturn Ġ" Report Ġon ĠGitHub " ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġsubmit ( events : ĠArray < out ĠIde a Logging Event >, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġadditional Info : ĠString ?, ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġparent Component : ĠComponent , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġconsumer : ĠConsumer < in ĠSub mitted Report Info >): ĠBoolean Ġ{ ĊĠĠĠ Ġval Ġproject Ġ= Ġcurrent Project ( parent Component ) ĊĠĠĠ Ġval Ġreporting Task Ġ= Ġobject Ġ: ĠTask . Background able ( project , Ġ" Submit Ġissue ") Ġ{ ĊĠĠĠĠĠ Ġoverride Ġfun Ġrun ( indicator : ĠProgress Indicator ) Ġ{ ĊĠĠĠĠĠĠĠ Ġindicator . text Ġ= Ġ" Issue Ġreporting ..." ĊĊĠĠĠĠĠĠĠ Ġval Ġrequest Ġ= Ġcreate Request () ĊĠĠĠĠĠĠĠ Ġpopulate Headers ( request ) Ġ?: Ġreturn ĊĠĠĠĠĠĠĠ Ġrequest . entity Ġ= Ġget Issue Content ( events , Ġadditional Info ) ĊĠĠĠĠĠĠĠ Ġcreate HttpClient (). use Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġval Ġexecute Ġ= Ġit . execute ( request ) ĊĠĠĠĠĠĠĠĠĠ Ġwhen Ġ( execute . status Line . statusCode ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠHttpStatus . SC _ CREATED Ġ-> Ġnotify User ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Report Ġsuccessful ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ"< a Ġhref =${ extract Link To Issue ( execute . entity )}> Click Ġto Ġopen Ġcreated Ġissue </ a >", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠNotification Type . INFORMATION ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġelse Ġ-> Ġnotify User (" Report Ġerror ", ĠStringUtils . EMPTY , ĠNotification Type . WARNING ) ĊĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĠĠĠ Ġstart Reporting ( reporting Task ) ĊĠĠĠ Ġreturn Ġtrue ĊĠ Ġ} ĊĊĠ Ġfun Ġcurrent Project ( parent Component : ĠComponent ) Ġ= ĊĠĠĠĠĠ ĠCommon Data Keys . PROJECT . getData ( DataManager . getInstance (). getData Context ( parent Component )) ĊĊĠ Ġfun ĠaccessToken Holder () Ġ= ĠGitHub AccessToken Holder () Ġas ĠAccess Token Holder ĊĊĠ Ġfun Ġissue Info Holder () Ġ= ĠGitHub Issue Info Factory ( Environment Info Provider Impl ()) Ġas ĠIssue Info Factory ĊĊĠ Ġfun Ġget Issue Content ( events : ĠArray < out ĠIde a Logging Event >, Ġadditional Info : ĠString ?) Ġ= ĊĠĠĠĠĠ ĠString Entity ( gson . toJson ( issue Info Holder (). create ( events [ 0 ], Ġplugin Descriptor , Ġadditional Info ))) ĊĊĠ Ġfun Ġstart Reporting ( reporting Task : ĠTask ) Ġ{ ĊĠĠĠ ĠProgress Manager . getInstance (). run ( reporting Task ) ĊĠ Ġ} ĊĊĠ Ġfun Ġcreate HttpClient () Ġ= ĠHttpClient Builder . create (). build () !! ĊĊĠ Ġfun Ġcreate Request (): ĠHttp Post Ġ{ ĊĠĠĠ Ġreturn ĠHttp Post (" https :// api . github . com / repos /${ config . userId }/${ config . repo Name }/ issues ") ĊĠ Ġ} ĊĊĠ Ġfun Ġnotify User ( title : ĠString , Ġtext : ĠString , Ġnotification Type : ĠNotification Type ) Ġ{ ĊĠĠĠ Ġval Ġnotification Ġ= ĠNotification ( plugin Descriptor . plugin Id . id String , ĊĠĠĠĠĠĠĠ Ġtitle , ĊĠĠĠĠĠĠĠ Ġtext , ĊĠĠĠĠĠĠĠ Ġnotification Type , ĊĠĠĠĠĠĠĠ ĠURL _ OPEN ING _ LIST ENER ) ĊĠĠĠ ĠNotifications . Bus . notify ( notification ) ĊĠ Ġ} ĊĊĠ Ġfun Ġpopulate Headers ( request : ĠHttp Post ): ĠHttp Post ? Ġ{ ĊĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠ Ġrequest . add Header ( Basic Header (" Authorization ", ĊĠĠĠĠĠĠĠĠĠ Ġ" token Ġ${ accessToken Holder (). getToken ()} ")) ĊĠĠĠĠĠ Ġrequest . add Header ( Basic Header (" Accept ", Ġ" application / vnd . github . v 3 + json ")) ĊĠĠĠĠĠ Ġrequest . add Header ( Basic Header (" Content - Type ", Ġ" application / json ")) ĊĠĠĠ Ġ} Ġcatch Ġ( ex : ĠToken Initialization Exception ) Ġ{ ĊĠĠĠĠĠ Ġnotify User (" Report Ġerror ", ĠStringUtils . EMPTY , ĠNotification Type . WARNING ) ĊĠĠĠĠĠ Ġreturn Ġnull ĊĠĠĠ Ġ} ĊĠĠĠ Ġreturn Ġrequest ĊĠ Ġ} ĊĊĠ Ġfun Ġextract Link To Issue ( entity : ĠHttp Entity ?): ĠString Ġ{ ĊĠĠĠ Ġreturn Ġentity ?. content ?. buffered Reader ()?. use Ġ{ ĊĠĠĠĠĠ Ġval Ġread Text Ġ= Ġit . read Text () ĊĠĠĠĠĠ Ġreturn @ use Ġgson . fromJson ( read Text , ĠCreated GitHub Issue :: class . java ). html Url ĊĠĠĠ Ġ} Ġ?: Ġ"" ĊĠ Ġ} Ċ } ĊĊ