/* Ċ Ġ* ĠCopyright Ġ 2 0 0 0 - 2 0 1 5 ĠJetBrains Ġs . r . o . Ċ Ġ* Ċ Ġ* Ġ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 . intellij . diff . statistics Ċ Ċ import Ġcom . intellij . diff . impl . Diff Settings Holder . Diff Settings Ċ import Ġcom . intellij . diff . tools . fragment ed . Unified Diff Tool Ċ import Ġcom . intellij . diff . tools . simple . Simple Diff Tool Ċ import Ġcom . intellij . diff . tools . util . base . Text Diff Settings Holder . Text Diff Settings Ċ import Ġcom . intellij . diff . util . Diff Places Ċ import Ġcom . intellij . internal . statistic . Usage s Collector Ċ import Ġcom . intellij . internal . statistic . beans . Group Descriptor Ċ import Ġcom . intellij . internal . statistic . beans . Usage Descriptor Ċ import Ġcom . intellij . util . containers . Container Util Ċ Ċ class ĠDiff Usage s Collector Ġ: ĠUs ages Collector () Ġ{ ĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġval ĠID Ġ= ĠGroup Descriptor . create (" Diff ") ĊĠĠĠ Ġval ĠVERSION Ġ= Ġ 1 ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġget GroupId (): ĠGroup Descriptor Ġ{ ĊĠĠĠ Ġreturn ĠID ĊĠ Ġ} ĊĊĠ Ġoverride Ġfun Ġget Usage s (): ĠSet < Usage Descriptor > Ġ{ ĊĠĠĠ Ġval Ġusage s : ĠMutable Map < String , ĠInt > Ġ= ĠContainer Util . new HashMap () ĊĠĠĠ Ġusage s [" Total "] Ġ= Ġ 1 ĊĊĊĠĠĠ ĠlistOf ( Diff Places . DEFAULT , ĠDiff Places . CHANG ES _ VIEW , ĠDiff Places . COMMIT _ DIALOG ). forEach Ġ{ Ġplace Ġ-> ĊĠĠĠĠĠ Ġval Ġdiff Settings Ġ= ĠDiff Settings . get Settings ( place ) ĊĠĠĠĠĠ Ġval Ġtext Settings Ġ= ĠText Diff Settings . get Settings ( place ) ĊĊĠĠĠĠĠ Ġusage s . increment (" Text Diff Settings . Ignore Policy ", Ġtext Settings . ignore Policy ) ĊĠĠĠĠĠ Ġusage s . increment (" Text Diff Settings . Highlight Policy ", Ġtext Settings . highlight Policy ) ĊĠĠĠĠĠ Ġusage s . increment (" Text Diff Settings . Expand ByDefault ", Ġtext Settings . is Expand ByDefault ) ĊĠĠĠĠĠ Ġusage s . increment (" Diff Settings . is Unified Tool ", Ġis Unified Tool Default ( diff Settings )) ĊĠĠĠ Ġ} ĊĊĊĠĠĠ Ġval Ġdiff Settings Ġ= ĠDiff Settings . get Settings ( null ) ĊĠĠĠ Ġusage s . increment (" Diff Settings . Iterate Next File ", Ġdiff Settings . is Go To Next File On Next Difference ) ĊĊĊĠĠĠ Ġreturn Ġusage s . map Ġ{ Ġit Ġ-> ĠUsage Descriptor (" diff .$ VERSION .${ it . key }", Ġit . value ) Ġ}. toSet () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġis Unified Tool Default ( settings : ĠDiff Settings ): ĠBoolean Ġ{ ĊĠĠĠ Ġval Ġtool Order Ġ= Ġsettings . diff Tools Order ĊĠĠĠ Ġval Ġdefault Tool Index Ġ= ĠContainer Util . indexOf ( tool Order , ĠSimple Diff Tool :: class . java . canonical Name ) ĊĠĠĠ Ġval Ġunified Tool Index Ġ= ĠContainer Util . indexOf ( tool Order , ĠUn ified Diff Tool :: class . java . canonical Name ) ĊĠĠĠ Ġreturn Ġunified Tool Index Ġ!= Ġ- 1 Ġ&& Ġunified Tool Index Ġ< Ġdefault Tool Index ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun ĠMutable Map < String , ĠInt >. increment ( key : ĠString ) Ġ{ ĊĠĠĠ Ġput ( key , Ġ( get ( key ) Ġ?: Ġ 0 ) Ġ+ Ġ 1 ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun ĠMutable Map < String , ĠInt >. increment ( prefix : ĠString , Ġsuffix : ĠEnum <* >) Ġ{ ĊĠĠĠ Ġincrement ("$ prefix .${ suffix . name }") ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun ĠMutable Map < String , ĠInt >. increment ( key : ĠString , Ġcondition : ĠBoolean ) Ġ{ ĊĠĠĠ Ġif Ġ( condition ) Ġincrement ( key ) ĊĠ Ġ} Ċ } Ċ