/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 9 ĠThe ĠAndroid ĠOpen ĠSource ĠProject Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ package Ġcom . android . tools . idea . compose . preview . actions Ċ Ċ import Ġcom . android . tools . adt ui . common . Colo red Icon Generator Ċ import Ġcom . android . tools . idea . common . surface . Design Surface Ċ import Ġcom . android . tools . idea . compose . preview . Compose Preview Bundle . message Ċ import Ġcom . android . tools . idea . compose . preview . find Compose Preview Managers For Context Ċ import Ġcom . android . tools . idea . compose . preview . util . request Build Ċ import Ġcom . android . tools . idea . gradle . project . build . Gradle Build State Ċ import Ġcom . intellij . icons . All Icons Ċ import Ġcom . intellij . openapi . action System . An Action Ċ import Ġcom . intellij . openapi . action System . An ActionEvent Ċ import Ġcom . intellij . ui . JB Color Ċ Ċ private Ġval ĠGREEN _ REFRESH _ BUTTON Ġ= ĠCo lo red Icon Generator . generate Colo red Icon ( All Icons . Actions . Force Refresh , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠJ B Color ( 0 x 5 9 A 8 6 9 , Ġ 0 x 4 9 9 C 5 4 )) ĊĊ Ċ internal Ġfun Ġrequest Build For Surface ( surface : ĠDesign Surface ) Ġ{ ĊĠ Ġsurface . models . map Ġ{ Ġit . module Ġ}. distinct (). forEach Ġ{ ĊĠĠĠ Ġrequest Build ( surface . project , Ġit ) ĊĠ Ġ} Ċ } Ċ Ċ /** Ċ Ġ* Ġ[ An Action ] Ġthat Ġtriggers Ġa Ġcompilation Ġof Ġthe Ġcurrent Ġmodule . ĠThe Ġbuild Ġwill Ġautomatically Ġtrigger Ġa Ġrefresh Ċ Ġ* Ġof Ġthe Ġsurface . Ċ Ġ*/ Ċ internal Ġclass ĠForce Compile And Refresh Action ( private Ġval Ġsurface : ĠDesign Surface ) Ġ: ĊĠ ĠAn Action ( message (" notification . action . build . and . refresh "), Ġnull , ĠGREEN _ REFRESH _ BUTTON ) Ġ{ ĊĠ Ġoverride Ġfun ĠactionPerformed ( e : ĠAn ActionEvent ) Ġ= Ġrequest Build For Surface ( surface ) ĊĊĠ Ġoverride Ġfun Ġupdate ( e : ĠAn ActionEvent ) Ġ{ ĊĠĠĠ Ġval Ġproject Ġ= Ġe . project Ġ?: Ġreturn ĊĠĠĠ Ġval Ġpresentation Ġ= Ġe . presentation ĊĠĠĠ Ġval Ġis Refresh ing Ġ= Ġfind Compose Preview Managers For Context ( e . data Context ). any Ġ{ Ġit . status (). is Refresh ing Ġ} ĊĠĠĠ Ġpresentation . isEnabled Ġ= Ġ! is Refresh ing Ġ&& Ġ! Gradle Build State . getInstance ( project ). is Build InProgress ĊĠ Ġ} Ċ }