// ĠCopyright Ġ 2 0 0 0 - 2 0 1 8 ĠJetBrains Ġs . r . o . ĠUse Ġof Ġthis Ġsource Ġcode Ġis Ġgoverned Ġby Ġthe ĠApache Ġ 2 . 0 Ġlicense Ġthat Ġcan Ġbe Ġfound Ġin Ġthe ĠLICENSE Ġfile . Ċ package Ġcom . intellij . openapi . vcs . changes Ċ Ċ import Ġcom . intellij . openapi . components . service Ċ import Ġcom . intellij . openapi . diagnostic . Logger Ċ import Ġcom . intellij . openapi . progress . util . Background Task Util Ċ import Ġcom . intellij . openapi . project . Project Ċ import Ġcom . intellij . openapi . project . Project Manager Listener Ċ import Ġcom . intellij . openapi . vcs . Project Level V cs Manager Ċ import Ġcom . intellij . openapi . vcs . Project Level V cs Manager . V CS _ CONFIGURATION _ CHANGED Ċ import Ġcom . intellij . openapi . vcs . V cs Listener Ċ import Ġcom . intellij . openapi . vcs . impl . Project Level V cs ManagerImpl Ċ import Ġcom . intellij . openapi . vcs . impl . V cs Init Object Ċ import Ġcom . intellij . openapi . vfs . Local FileSystem Ċ import Ġcom . intellij . project . isDirectory Based Ċ import Ġcom . intellij . project . state Store Ċ import Ġcom . intellij . vcs Util . V cs Impl Util Ċ import Ġcom . intellij . vcs Util . V cs Util Ċ Ċ private Ġval ĠLOG Ġ= ĠLogger . getInstance ( V cs Ignore Files Checker :: class . java ) Ċ Ċ class ĠV cs Ignore Files Checker Ġ: ĠProject Manager Listener Ġ{ ĊĊĠ Ġoverride Ġfun Ġproject Opened ( project : ĠProject ) Ġ{ ĊĠĠĠ Ġproject . message Bus . connect () ĊĠĠĠĠĠ Ġ. subscribe ( V CS _ CONFIGURATION _ CHANGED , ĠV cs Listener Ġ{ ĊĠĠĠĠĠĠĠ Ġ( project . service < Project Level V cs Manager >() Ġas ĠProject Level V cs ManagerImpl ) ĊĠĠĠĠĠĠĠĠĠ Ġ. add Initialization Request ( V cs Init Object . AFTER _ COMMON ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠBackground Task Util . execute On P ooled Thread ( project , ĠRunnable Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġgenerate V cs Ignore File In Root IfNeeded ( project ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ}) ĊĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ}) ĊĠ Ġ} ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠPro pose Ġto Ġmanage Ġ( generate ) Ġignore Ġfile Ġin Ġproject ĠV CS Ġroot Ġdirectory . ĊĠĠ Ġ*/ ĊĠ Ġprivate Ġfun Ġgenerate V cs Ignore File In Root IfNeeded ( project : ĠProject ) Ġ{ ĊĠĠĠ Ġif Ġ( project . is Disposed ) Ġreturn ĊĊĠĠĠ Ġval Ġproject File Ġ= Ġproject . getProject Config Dir Or Project File () Ġ?: Ġreturn ĊĠĠĠ Ġval Ġproject File V cs Root Ġ= ĠV cs Util . get V cs Root For ( project , Ġproject File ) Ġ?: Ġreturn ĊĠĠĠ Ġval Ġv cs Ġ= ĠV cs Util . get V cs For ( project , Ġproject File V cs Root ) Ġ?: Ġreturn ĊĊĠĠĠ ĠLOG . debug (" Pro pose Ġmanage ĠV CS Ġignore Ġin Ġ${ project File V cs Root . path } Ġfor Ġv cs Ġ${ vcs . name }") ĊĠĠĠ ĠV cs Impl Util . pro pose Update Ignore File ( project , Ġv cs , Ġproject File V cs Root ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun ĠProject . getProject Config Dir Or Project File () Ġ= ĊĠĠĠ Ġif Ġ( isDirectory Based ) Ġstate Store . project Config Dir ?. let ( Local FileSystem . getInstance () :: find File By Path ) ĊĠĠĠ Ġelse Ġproject File Ċ }