package Ġcom . so yle . stories . so yle stories Ċ Ċ import Ġcom . so yle . stories . common . async Ċ import Ġcom . so yle . stories . di . resolve Ċ import Ġcom . so yle . stories . project . project List . Project ListView Listener Ċ import Ġjavafx . scene . Parent Ċ import Ġjavafx . scene . control . Alert Ċ import Ġjavafx . scene . control . Button Bar Ċ import Ġjavafx . scene . control . Button Type Ċ import Ġjavafx . stage . Modal ity Ċ import Ġt orn ad of x . View Ċ import Ġt orn ad of x . onChange Ċ import Ġt orn ad of x . onChange Once Ċ import Ġt orn ad of x . region ĊĊ Ċ class ĠOpen Project Option Dialog Ġ: ĠView (" Open ĠProject ĠOptions ") Ġ{ ĊĊ ĉ override Ġval Ġscope : ĠApplication Scope Ġ= Ġsuper . scope Ġas ĠApplication Scope ĊĊ ĉ private Ġval Ġmodel Ġ= Ġfind < ApplicationModel >() Ċ ĉ private Ġval Ġproject ListView Listener Ġ= Ġresolve < Project ListView Listener >() ĊĊ ĉ override Ġval Ġroot : ĠParent Ġ= Ġregion () ĊĊ ĉ private Ġfun Ġalert (): ĠAlert Ġ= ĠAlert ( Alert . Alert Type . CONFIRM ATION , Ġ"", Ċĉ ĉ Button Type (" This ĠWindow ", ĠButton Bar . Button Data . YES ), Ċĉ ĉ Button Type (" New ĠWindow ", ĠButton Bar . Button Data . NO ), Ċĉ ĉ Button Type . CANCEL Ċ ĉ ). apply Ġ{ Ċĉ ĉ title Ġ= Ġ" Open ĠProject ĠOptions " Ċĉ ĉ header Text Ġ= Ġ" How Ġwould Ġyou Ġlike Ġto Ġopen Ġthe Ġproject ?" Ċ ĉ } Ċ ĉ private Ġvar Ġprevious Alert : ĠAlert ? Ġ= Ġnull ĊĊ ĉ init Ġ{ Ċĉ ĉ model . isOpen Project Options Dialog Open . onChange Ġ{ ĠisOpen Ġ-> Ċĉĉ ĉ if Ġ( isOpen ) Ġ{ Ċĉĉĉ ĉ val Ġproject Location Ġ= Ġmodel . open Project Request . value !!. location Ċĉĉĉ ĉ val Ġalert Ġ= Ġalert () Ċĉĉĉ ĉ alert . init Modal ity ( Modal ity . APPLICATION _ MOD AL ) Ċĉĉĉ ĉ alert . init Owner ( current Window ) Ċĉĉĉ ĉ alert . result Property (). onChange Once Ġ{ Ċĉĉĉĉ ĉ when Ġ( it ?. button Data ) Ġ{ Ċĉĉĉĉĉ ĉ Button Bar . Button Data . YES Ġ-> Ġ{ Ċĉĉĉĉĉĉ ĉ async ( scope ) Ġ{ Ċĉĉĉĉĉĉĉ ĉ project ListView Listener . replace Current Project ( project Location ) Ċĉĉĉĉĉĉ ĉ } Ċĉĉĉĉĉ ĉ } Ċĉĉĉĉĉ ĉ Button Bar . Button Data . NO Ġ-> Ġ{ Ċĉĉĉĉĉĉ ĉ async ( scope ) Ġ{ Ċĉĉĉĉĉĉĉ ĉ project ListView Listener . force Open Project ( project Location ) Ċĉĉĉĉĉĉ ĉ } Ċĉĉĉĉĉ ĉ } Ċĉĉĉĉĉ ĉ Button Bar . Button Data . CANCEL _ CLOSE Ġ-> Ġ{ Ċĉĉĉĉĉĉ ĉ model . open Project Request . value Ġ= Ġnull Ċĉĉĉĉĉ ĉ } Ċĉĉĉĉĉ ĉ else Ġ-> Ġ{} Ċĉĉĉĉ ĉ } Ċĉĉĉ ĉ } Ċĉĉĉ ĉ previous Alert Ġ= Ġalert Ċĉĉĉ ĉ alert . show () Ċĉĉ ĉ } Ġelse Ġ{ Ċĉĉĉ ĉ previous Alert ?. close () Ċĉĉĉ ĉ previous Alert Ġ= Ġnull Ċĉĉ ĉ } Ċĉ ĉ } Ċ ĉ } Ċ Ċ }